32 #include <sys/timeb.h> 67 #if defined (SERVER_MODE) 70 #if defined(ENABLE_SYSTEMTAP) 94 #define GOTO_EXIT_ON_ERROR \ 97 qexec_failure_line (__LINE__, xasl_state); \ 111 #define QPROC_MAX_GROUPED_SCAN_CNT (4) 114 #define QPROC_SINGLE_CLASS_GROUPED_SCAN (0) 117 #define CONNECTBY_TUPLE_INDEX_STRING_MEM 64 120 #define HASH_AGGREGATE_DEFAULT_TABLE_SIZE 1000 124 #define HASH_AGGREGATE_VH_SELECTIVITY_TUPLE_THRESHOLD 200 127 #define HASH_AGGREGATE_VH_SELECTIVITY_THRESHOLD 0.5f 130 #define QEXEC_CLEAR_AGG_LIST_VALUE(agg_list) \ 133 AGGREGATE_TYPE *agg_ptr; \ 134 for (agg_ptr = (agg_list); agg_ptr; agg_ptr = agg_ptr->next) \ 136 if (agg_ptr->function == PT_GROUPBY_NUM) \ 138 pr_clear_value (agg_ptr->accumulator.value); \ 143 #define QEXEC_EMPTY_ACCESS_SPEC_SCAN(specp) \ 144 ((specp)->type == TARGET_CLASS \ 145 && ((ACCESS_SPEC_HFID((specp)).vfid.fileid == NULL_FILEID || ACCESS_SPEC_HFID((specp)).vfid.volid == NULL_VOLID))) 147 #define QEXEC_IS_MULTI_TABLE_UPDATE_DELETE(xasl) \ 148 (xasl->upd_del_class_cnt > 1 || (xasl->upd_del_class_cnt == 1 && xasl->scan_ptr != NULL)) 150 #define QEXEC_SEL_UPD_USE_REEVALUATION(xasl) \ 151 ((xasl) && ((xasl)->spec_list) && ((xasl)->spec_list->next == NULL) \ 152 && ((xasl)->spec_list->pruning_type == DB_NOT_PARTITIONED_CLASS) \ 153 && ((xasl)->aptr_list == NULL) && ((xasl)->scan_ptr == NULL)) 160 #if !defined(SERVER_MODE) 161 #define pthread_mutex_init(a, b) 162 #define pthread_mutex_destroy(a) 163 #define pthread_mutex_lock(a) 0 164 #define pthread_mutex_unlock(a) 374 #define QEXEC_GET_BH_TOPN_TUPLE(heap, index) (*(TOPN_TUPLE **) BH_ELEMENT (heap, index)) 440 bool * output_tuple);
483 int max_group_changes,
bool ignore_nulls);
506 bool force_select_lock,
int fixed,
int grouped,
bool iscan_oid_order,
SCAN_ID * s_id,
508 bool * p_mvcc_select_lock_needed);
531 const HFID * class_hfid,
ATTR_ID attrid,
int n_increment,
int pruning_type);
568 bool * empty_result);
582 #if defined(SERVER_MODE) 583 #if defined (ENABLE_UNUSED_FUNCTION) 584 static int tranid_compare (
const void *t1,
const void *t2);
592 char **son_index,
int *len_son_index);
600 DB_VALUE ** index_valp,
char **index_value,
int *index_len);
622 int total_order,
int *start_colp);
624 int *start_colp,
int collation);
660 int *helpers_countp);
683 #if defined(SERVER_MODE) 806 OID instance_oid, class_oid;
811 while (reg_var_list && idx < upd_del_cls_cnt)
813 if (reg_var_list->
next ==
NULL && default_cls_oid ==
NULL)
823 reg_var_list = reg_var_list->
next;
847 if (default_cls_oid !=
NULL)
849 COPY_OID (&class_oid, default_cls_oid);
890 reg_var_list = reg_var_list->
next;
992 int ret =
NO_ERROR, idx, rem_cnt = 0;
1004 while (reg_var_list !=
NULL && idx < xasl->upd_del_class_cnt)
1040 eh_search =
ehash_search (thread_p, ehid, &key_oid, &oid);
1065 reg_var_list = reg_var_list->
next;
1066 if (reg_var_list !=
NULL)
1069 reg_var_list = reg_var_list->
next;
1107 bool output_tuple =
true;
1124 #if defined (ENABLE_COMPOSITE_LOCK) 1181 switch (tpldescr_status)
1184 if (xasl->topn_items !=
NULL)
1207 output_tuple =
false;
1375 for (value_list = single_tuple->
valp, i = 0; i < single_tuple->val_cnt; value_list = value_list->
next, i++)
1390 xasl->status = XASL_CLEARED;
1395 xasl->status = XASL_INITIALIZED;
1401 xasl->status = XASL_CLEARED;
1459 regu_var->domain = regu_var->original_domain;
1461 #if !defined(NDEBUG) 1476 switch (regu_var->type)
1481 regu_var->value.attr_descr.cache_dbvalp =
NULL;
1505 if (regu_var->xasl !=
NULL)
1521 else if (regu_var->xasl->status != XASL_CLEARED)
1535 if (regu_var->value.funcp->tmp_obj !=
NULL)
1537 switch (regu_var->value.funcp->ftype)
1545 delete regu_var->value.funcp->tmp_obj->compiled_regex;
1554 delete regu_var->value.funcp->tmp_obj;
1555 regu_var->value.funcp->tmp_obj =
NULL;
1593 if (regu_var->vfetch_to !=
NULL)
1616 for (p = list;
p; p = p->
next)
1639 for (list_node = list->
regu_list; list_node; list_node = list_node->
next)
1657 for (p = list;
p; p = p->
next)
1688 for (p = list;
p; p = p->
next)
1795 for (p = list;
p; p = p->
next)
1797 memset (&p->s_id.scan_stats, 0, sizeof (
SCAN_STATS));
1799 if (p->parts !=
NULL)
1809 if (p->clear_value_at_clone_decache)
1817 if (!p->clear_value_at_clone_decache)
1828 switch (p->s_id.
type)
1838 hsidp = &p->s_id.
s.hsid;
1855 hpsidp = &p->s_id.
s.hpsid;
1870 if (p->s_id.
s.isid.indx_cov.regu_val_list !=
NULL)
1875 if (p->s_id.
s.isid.indx_cov.output_val_list !=
NULL)
1881 isidp = &p->s_id.
s.isid;
1898 isidp = &p->s_id.
s.isid;
1911 insidp = &p->s_id.
s.insid;
1934 bool jt_clear_default_values =
1936 p->s_id.
s.jtid.clear (xasl_p, is_final, jt_clear_default_values);
1946 if (p->s_id.val_list)
1967 for (i = 0; i < N; i++)
2051 for (e = list; e; e = e->
next)
2082 for (p = list;
p; p = p->
next)
2133 int query_save_state;
2134 unsigned int decache_clone_flag = 0;
2158 #if defined (ENABLE_COMPOSITE_LOCK) 2160 assert (xasl->composite_lock.lockcomp.class_list ==
NULL);
2279 if (xasl->topn_items !=
NULL)
2284 heap = xasl->topn_items->heap;
2295 if (xasl->topn_items->tuples !=
NULL)
2304 memset (&xasl->orderby_stats, 0, sizeof (ORDERBY_STATS));
2305 memset (&xasl->groupby_stats, 0, sizeof (GROUPBY_STATS));
2306 memset (&xasl->xasl_stats, 0, sizeof (XASL_STATS));
2366 if (buildlist->upddel_oid_locator_ehids !=
NULL)
2527 for (regu_list = valptr_list->
valptrp; regu_list !=
NULL; regu_list = regu_list->
next)
2617 for (xasl = xasl_list; xasl !=
NULL; xasl = xasl->
next)
2639 for (xasl = xasl_list; xasl !=
NULL; xasl = xasl->
scan_ptr)
2666 for (xasl = xasl_list; xasl !=
NULL; xasl = xasl->
next)
2754 if (list_id ==
NULL)
2772 for (value_list = single_tuple->
valp, i = 0; i < single_tuple->val_cnt; value_list = value_list->
next, i++)
2864 char *data, *tvalhp;
2917 if (
VPID_EQ (&(info->fixed_vpid), &vpid))
2920 page = info->fixed_page;
2925 if (info->fixed_page !=
NULL)
2939 info->fixed_vpid = vpid;
2940 info->fixed_page = page;
3054 if (limit_ptr ==
NULL)
3130 UINT64 old_sort_pages = 0, old_sort_ioreads = 0;
3136 if (xasl->orderby_stats.orderby_filesort)
3143 if (xasl->topn_items !=
NULL)
3159 if (xasl->orderby_stats.orderby_filesort)
3164 - old_sort_ioreads);
3196 SORT_LIST *orderby_ptr, *order_ptr, *orderby_list;
3198 bool orderby_alloc =
false;
3199 int k, n,
i, ls_flag;
3206 xasl->orderby_stats.orderby_filesort =
true;
3230 if (outptr_list !=
NULL)
3246 orderby_list = order_list;
3247 orderby_alloc =
false;
3253 if (orderby_list ==
NULL)
3260 orderby_alloc =
true;
3261 for (k = 0, order_ptr = orderby_list; k < list_id->
type_list.
type_cnt; k++, order_ptr = order_ptr->
next)
3267 order_ptr->s_order =
S_DESC;
3272 order_ptr->s_order =
S_ASC;
3276 order_ptr->pos_descr.pos_no = k;
3280 for (orderby_ptr = order_list, order_ptr = orderby_list; orderby_ptr !=
NULL;
3281 orderby_ptr = orderby_ptr->
next, order_ptr = order_ptr->
next)
3284 temp_ord.
s_order = order_ptr->s_order;
3285 temp_ord.
s_nulls = order_ptr->s_nulls;
3290 order_ptr->s_order = orderby_ptr->
s_order;
3291 order_ptr->s_nulls = orderby_ptr->
s_nulls;
3296 for (order_ptr2 = order_ptr->
next; order_ptr2 !=
NULL; order_ptr2 = order_ptr2->
next)
3316 for (n = 0, regu_list = outptr_list->
valptrp; regu_list; regu_list = regu_list->
next)
3334 for (n = 0, i = 0, regu_list = outptr_list->
valptrp; regu_list; regu_list = regu_list->
next, i++)
3374 if (list_id ==
NULL)
3388 if (orderby_alloc ==
true)
3490 gbstate->fixed_page =
NULL;
3503 gbstate->
xasl = xasl;
3559 gby_col = groupby_list;
3561 if (sort_list ==
NULL)
3574 sort_col = sort_col->
next;
3575 gby_col = gby_col->
next;
3628 if (gbstate->fixed_page !=
NULL)
3753 if (new_key ==
NULL)
3761 if (new_value ==
NULL)
3770 int tuple_size = tpldesc->
tpl_size;
3793 *output_tuple =
false;
3811 *output_tuple =
false;
3837 while (context->
hash_size > (
int) mem_limit)
3866 #if !defined(NDEBUG) 3890 #if !defined(NDEBUG) 3901 xasl->groupby_stats.groupby_hash = context->
state;
4023 while (agg_list !=
NULL)
4027 &agg_list->accumulator_domain, agg_list->
function,
4035 agg_list = agg_list->
next;
4102 int peek,
i, rollup_level;
4134 if (
VPID_EQ (&(info->fixed_vpid), &vpid))
4137 page = info->fixed_page;
4142 if (info->fixed_page !=
NULL)
4155 info->fixed_vpid = vpid;
4156 info->fixed_page = page;
4320 for (i = 1; i < rollup_level; i++)
4329 &ru_agg_list->accumulator_domain,
4336 ru_agg_list = ru_agg_list->
next;
4393 int estimated_pages;
4398 UINT64 old_sort_pages = 0, old_sort_ioreads = 0;
4408 xasl->groupby_stats.run_groupby =
true;
4409 xasl->groupby_stats.rows = 0;
4439 buildlist->agg_hash_context, xasl, xasl_state, &list_id->
type_list,
4470 if (output_list_id ==
NULL)
4472 if (output_type_list.
domp)
4480 if (output_type_list.
domp)
4550 xasl->groupby_stats.groupby_sort =
true;
4672 #if defined (ENABLE_COMPOSITE_LOCK) 4706 if (gbstate.fixed_page !=
NULL)
4741 if (xasl->groupby_stats.groupby_sort ==
true)
4746 - old_sort_ioreads);
4779 for (i = 0; i <
db_set_size (col) && !result; i++)
4832 int i,
cmp, left_len, right_len;
4833 bool left_is_set, right_is_set;
4837 for (i = 0; i < tval_cnt; i++)
4862 if (left_dom[i]->type->data_readval (&buf, &left_dbval, left_dom[i], -1, left_is_set,
NULL, 0) !=
NO_ERROR)
4877 if (rght_dom[i]->type->data_readval (&buf, &right_dbval, rght_dom[i], -1, right_is_set,
NULL, 0) !=
NO_ERROR)
4996 int tpl_size, offset;
4998 INT32 ls_unbound[2] = { 0, 0 };
5022 t_valhp = (
char *) ls_unbound;
5033 t_valhp = (
char *) ls_unbound;
5038 if ((tplrec->
size - offset) < t_val_size)
5048 memcpy (tplp, t_valhp, t_val_size);
5050 offset += t_val_size;
5075 int tplrec1_max_size;
5076 int tplrec2_max_size;
5137 #define QEXEC_MERGE_ADD_MERGETUPLE(thread_p, t1, t2) \ 5139 if (qexec_merge_tuple_add_list((thread_p), list_idp, (t1), (t2), \ 5140 merge_infop, &tplrec) != NO_ERROR) { \ 5141 goto exit_on_error; \ 5145 #define QEXEC_MERGE_PVALS(pre) \ 5148 for (_v = 0; _v < nvals; _v++) { \ 5150 QFILE_GET_TUPLE_VALUE_HEADER_POSITION((pre##_tplrec).tpl, \ 5152 (pre##_valp)[_v]); \ 5158 #define QEXEC_MERGE_NEXT_SCAN(thread_p, pre, e) \ 5160 pre##_scan = qfile_scan_list_next((thread_p), &(pre##_sid), &(pre##_tplrec), PEEK); \ 5161 if ((e) && pre##_scan == S_END) \ 5163 if (pre##_scan == S_ERROR) \ 5164 goto exit_on_error; \ 5167 #define QEXEC_MERGE_PREV_SCAN(thread_p, pre) \ 5169 pre##_scan = qfile_scan_list_prev((thread_p), &(pre##_sid), &(pre##_tplrec), PEEK); \ 5170 if (pre##_scan == S_ERROR) \ 5171 goto exit_on_error; \ 5174 #define QEXEC_MERGE_NEXT_SCAN_PVALS(thread_p, pre, e) \ 5176 QEXEC_MERGE_NEXT_SCAN((thread_p), pre, e); \ 5177 if (pre##_scan == S_SUCCESS) { \ 5178 QEXEC_MERGE_PVALS(pre); \ 5182 #define QEXEC_MERGE_REV_SCAN_PVALS(thread_p, pre) \ 5184 QEXEC_MERGE_PREV_SCAN((thread_p), pre); \ 5185 if (pre##_scan == S_SUCCESS) { \ 5186 QEXEC_MERGE_PVALS(pre); \ 5191 #define QEXEC_MERGE_OUTER_NEXT_SCAN(thread_p, pre, e) \ 5193 pre##_sid->qualification = QPROC_QUALIFIED_OR_NOT; \ 5194 pre##_scan = scan_next_scan((thread_p), pre##_sid); \ 5195 if ((e) && pre##_scan == S_END) \ 5197 if (pre##_scan == S_ERROR) \ 5198 goto exit_on_error; \ 5201 #define QEXEC_MERGE_OUTER_PREV_SCAN(thread_p, pre) \ 5203 pre##_sid->qualification = QPROC_QUALIFIED_OR_NOT; \ 5204 pre##_scan = scan_prev_scan((thread_p), pre##_sid); \ 5205 if (pre##_scan == S_ERROR) \ 5206 goto exit_on_error; \ 5209 #define QEXEC_MERGE_OUTER_NEXT_SCAN_PVALS(thread_p, pre, e) \ 5211 QEXEC_MERGE_OUTER_NEXT_SCAN((thread_p), pre, e); \ 5212 if (pre##_scan == S_SUCCESS) { \ 5213 QEXEC_MERGE_PVALS(pre); \ 5217 #define QEXEC_MERGE_OUTER_PREV_SCAN_PVALS(thread_p, pre) \ 5219 QEXEC_MERGE_OUTER_PREV_SCAN((thread_p), pre); \ 5220 if (pre##_scan == S_SUCCESS) { \ 5221 QEXEC_MERGE_PVALS(pre); \ 5252 int *outer_indp, *inner_indp;
5253 char **outer_valp =
NULL, **inner_valp =
NULL;
5259 int k, cnt, group_cnt, already_compared;
5279 for (k = 0; k < type_list.
type_cnt; k++)
5298 if (list_idp ==
NULL)
5316 if (outer_domp ==
NULL)
5322 if (inner_domp ==
NULL)
5327 for (k = 0; k < nvals; k++)
5334 outer_valp = (
char **)
db_private_alloc (thread_p, nvals *
sizeof (
char *));
5335 if (outer_valp ==
NULL)
5340 inner_valp = (
char **)
db_private_alloc (thread_p, nvals *
sizeof (
char *));
5341 if (inner_valp ==
NULL)
5356 for (k = 0; k < nvals; k++)
5375 for (k = 0; k < nvals; k++)
5392 already_compared =
false;
5398 if (!already_compared)
5406 already_compared =
false;
5409 if (val_cmp ==
DB_LT)
5420 if (val_cmp ==
DB_GT)
5430 if (val_cmp !=
DB_EQ)
5453 if (inner_scan ==
S_END)
5460 if (val_cmp !=
DB_EQ)
5472 if (cnt >= group_cnt)
5491 if (inner_scan ==
S_END)
5509 if (val_cmp ==
DB_LT)
5521 if (val_cmp ==
DB_EQ)
5539 already_compared =
true;
5586 if (val_cmp !=
DB_EQ)
5591 if (inner_scan ==
S_END)
5605 already_compared =
true;
5684 int *outer_indp, *inner_indp;
5685 char **outer_valp =
NULL, **inner_valp =
NULL;
5691 int k, cnt, group_cnt, merge_cnt, already_compared;
5694 bool all_lefts, all_rghts;
5724 for (k = 0; k < type_list.
type_cnt; k++)
5733 if (list_idp ==
NULL)
5738 if (all_lefts && outer_list_idp->
tuple_cnt == 0)
5743 if (all_rghts && inner_list_idp->
tuple_cnt == 0)
5757 if (outer_domp ==
NULL)
5763 if (inner_domp ==
NULL)
5768 for (k = 0; k < nvals; k++)
5775 outer_valp = (
char **)
db_private_alloc (thread_p, nvals *
sizeof (
char *));
5776 if (outer_valp ==
NULL)
5781 inner_valp = (
char **)
db_private_alloc (thread_p, nvals *
sizeof (
char *));
5782 if (inner_valp ==
NULL)
5810 for (k = 0; k < nvals; k++)
5839 for (k = 0; k < nvals; k++)
5862 already_compared =
false;
5868 if (!already_compared)
5876 already_compared =
false;
5879 if (val_cmp ==
DB_LT)
5901 if (val_cmp ==
DB_GT)
5922 if (val_cmp !=
DB_EQ)
5938 if (other_outer_join_pred !=
NULL)
5940 ev_res =
eval_pred (thread_p, other_outer_join_pred, &xasl_state->
vd,
NULL);
5948 if (other_outer_join_pred ==
NULL || ev_res ==
V_TRUE)
5969 if (!(other_outer_join_pred ==
NULL || ev_res ==
V_TRUE))
5983 if (inner_scan ==
S_END)
6000 if (val_cmp !=
DB_EQ)
6023 if (cnt >= group_cnt)
6052 if (inner_scan ==
S_END)
6070 if (val_cmp ==
DB_LT)
6082 if (val_cmp ==
DB_EQ)
6100 already_compared =
true;
6118 if (other_outer_join_pred !=
NULL)
6120 ev_res =
eval_pred (thread_p, other_outer_join_pred, &xasl_state->
vd,
NULL);
6128 if (other_outer_join_pred ==
NULL || ev_res ==
V_TRUE)
6174 if (val_cmp !=
DB_EQ)
6179 if (inner_scan ==
S_END)
6193 already_compared =
true;
6207 while (outer_scan !=
S_END)
6222 if (val_cmp ==
DB_NE)
6229 else if (val_cmp ==
DB_EQ)
6241 while (inner_scan !=
S_END)
6298 all_lefts = all_rghts =
false;
6371 outer_spec->fixed_scan, outer_spec->grouped_scan,
true, &outer_spec->s_id,
6378 inner_spec->fixed_scan, inner_spec->grouped_scan,
true, &inner_spec->s_id,
6387 xasl_state, ls_flag);
6396 if (list_id ==
NULL)
6443 bool force_select_lock,
int fixed,
int grouped,
bool iscan_oid_order,
SCAN_ID * s_id,
6445 bool * p_mvcc_select_lock_needed)
6450 bool mvcc_select_lock_needed =
false;
6465 assert (!force_select_lock);
6475 if (force_select_lock)
6477 mvcc_select_lock_needed =
true;
6485 switch (curr_spec->
type)
6530 error_code =
scan_open_heap_scan (thread_p, s_id, mvcc_select_lock_needed, scan_op_type, fixed, grouped,
6590 error_code =
scan_open_index_scan (thread_p, s_id, mvcc_select_lock_needed, scan_op_type, fixed, grouped,
6605 iscan_oid_order, query_id);
6725 if (p_mvcc_select_lock_needed)
6727 *p_mvcc_select_lock_needed = mvcc_select_lock_needed;
6738 curr_spec->parts =
NULL;
6739 curr_spec->curent =
NULL;
6740 curr_spec->pruned =
false;
6757 if (curr_spec ==
NULL)
6763 switch (curr_spec->
type)
6776 if (curr_spec->parts !=
NULL)
6780 curr_spec->parts =
NULL;
6781 curr_spec->curent =
NULL;
6782 curr_spec->pruned =
false;
6859 else if (sb_scan ==
S_END)
6865 *spec = (*spec)->
next;
6870 *spec = (*spec)->
next;
6940 class_oid = &xasl->
curr_spec->s_id.
s.hsid.cls_oid;
6941 class_hfid = &xasl->
curr_spec->s_id.
s.hsid.hfid;
6945 class_oid = &xasl->
curr_spec->s_id.
s.hpsid.cls_oid;
6946 class_hfid = &xasl->
curr_spec->s_id.
s.hpsid.hfid;
6951 class_oid = &xasl->
curr_spec->s_id.
s.isid.cls_oid;
6952 class_hfid = &xasl->
curr_spec->s_id.
s.isid.hfid;
6977 else if (sb_scan ==
S_END)
7040 for (last_xptr = xasl; last_xptr->
scan_ptr; last_xptr = last_xptr->
scan_ptr)
7044 && !last_xptr->
curr_spec->s_id.qualified_block))
7055 && !last_xptr->
curr_spec->s_id.qualified_block)
7060 for (xptr2 = last_xptr; xptr2; xptr2 = xptr2->
scan_ptr)
7081 for (xptr2 = last_xptr; xptr2; xptr2 = xptr2->
scan_ptr)
7090 else if (sb_next ==
S_END)
7093 for (xptr3 = xasl; xptr3 && xptr3 != xptr2->
scan_ptr; xptr3 = xptr3->
scan_ptr)
7118 while (last_xptr != xasl)
7122 for (prev_xptr = xasl; prev_xptr->
scan_ptr != last_xptr; prev_xptr = prev_xptr->
scan_ptr)
7135 for (xptr2 = prev_xptr; xptr2; xptr2 = xptr2->
scan_ptr)
7144 else if (sb_next ==
S_END)
7147 for (xptr3 = xasl; xptr3 && xptr3 != xptr2->
scan_ptr; xptr3 = xptr3->
scan_ptr)
7181 last_xptr = prev_xptr;
7225 xs_scan = (*next_scan_fnc) (thread_p, xasl->
scan_ptr, xasl_state, ignore, next_scan_fnc + 1);
7226 if (xs_scan !=
S_END)
7362 xasl->
curr_spec->s_id.qualified_block =
true;
7374 xs_scan = (*next_scan_fnc) (thread_p, xasl->
scan_ptr, xasl_state, ignore, next_scan_fnc + 1);
7375 if (xs_scan ==
S_END)
7488 var->value.attr_descr.cache_dbvalp =
NULL;
7517 PARTITION_SPEC_TYPE *partition_spec =
NULL;
7522 if (spec ==
NULL || spec->pruned)
7528 spec->pruned =
true;
7549 for (partition_spec = spec->parts; partition_spec !=
NULL; partition_spec = partition_spec->next)
7574 bool mvcc_select_lock_needed = spec->s_id.mvcc_select_lock_needed;
7575 int fixed = spec->s_id.fixed;
7576 int grouped = spec->s_id.grouped;
7578 VAL_LIST *val_list = spec->s_id.val_list;
7580 bool iscan_oid_order = spec->s_id.
s.isid.iscan_oid_order;
7582 QUERY_ID
query_id = spec->s_id.
s.isid.indx_cov.query_id;
7592 if (spec->parts ==
NULL)
7597 if (spec->curent ==
NULL)
7599 spec->curent = spec->parts;
7606 spec->curent =
NULL;
7610 spec->curent = spec->curent->
next;
7624 if (spec->curent ==
NULL)
7636 COPY_OID (&class_oid, &spec->curent->oid);
7637 HFID_COPY (&class_hfid, &spec->curent->hfid);
7640 btid = spec->curent->
btid;
7665 scan_open_heap_scan (thread_p, &spec->s_id, mvcc_select_lock_needed, scan_op_type, fixed, grouped, single_fetch,
7713 idxptr->
btid = btid;
7714 spec->s_id.
s.isid.scancache_inited =
false;
7715 spec->s_id.
s.isid.caches_inited =
false;
7718 scan_open_index_scan (thread_p, &spec->s_id, mvcc_select_lock_needed, scan_op_type, fixed, grouped,
7719 single_fetch, spec->
s_dbval, val_list, vd, idxptr, &class_oid, &class_hfid,
7734 if (spec->s_id.
s.hsid.caches_inited)
7738 spec->s_id.
s.hsid.caches_inited =
false;
7754 if (spec->curent ==
NULL)
7783 #define CTE_CURRENT_SCAN_READ_TUPLE(node) \ 7784 ((((node)->curr_spec->type == TARGET_LIST && (node)->curr_spec->s_id.type == S_LIST_SCAN)) \ 7785 ? ((node)->curr_spec->s_id.s.llsid.lsid.curr_tplno) : -1) 7786 #define CTE_CURR_ITERATION_LAST_TUPLE(node) \ 7787 ((((node)->curr_spec->type == TARGET_LIST && (node)->curr_spec->s_id.type == S_LIST_SCAN)) \ 7788 ? ((node)->curr_spec->s_id.s.llsid.list_id->tuple_cnt - 1) : -1) 7797 bool count_star_with_iscan_opt =
false;
7799 int curr_iteration_last_cursor = 0;
7800 int recursive_iterations = 0;
7801 bool max_recursive_iterations_reached =
false;
7802 bool cte_start_new_iteration =
false;
7810 bool is_scan_needed =
false;
7817 is_scan_needed =
true;
7823 is_scan_needed =
true;
7826 if (!is_scan_needed)
7847 specp->s_id.
s.isid.need_count_only =
true;
7848 count_star_with_iscan_opt =
true;
7867 int cte_offset_read_tuple = 0;
7868 int cte_curr_scan_tplno = -1;
7875 cte_start_new_iteration =
true;
7876 recursive_iterations = 1;
7887 cte_offset_read_tuple += cte_curr_scan_tplno + 1;
7892 if (cte_start_new_iteration)
7894 recursive_iterations++;
7897 max_recursive_iterations_reached =
true;
7902 assert (curr_iteration_last_cursor >= 0);
7903 cte_start_new_iteration =
false;
7906 if (cte_curr_scan_tplno + cte_offset_read_tuple == curr_iteration_last_cursor)
7908 cte_start_new_iteration =
true;
7912 if (count_star_with_iscan_opt)
8081 xasl->
curr_spec->s_id.qualified_block =
true;
8093 while ((xs_scan = (*next_scan_fnc) (thread_p, xasl->
scan_ptr, xasl_state, tplrec,
8150 if (xs_scan !=
S_END)
8162 if (max_recursive_iterations_reached)
8169 if (ls_scan !=
S_END)
8175 if (xb_scan !=
S_END)
8182 #undef CTE_CURRENT_SCAN_READ_TUPLE 8183 #undef CTE_CURR_ITERATION_LAST_TUPLE 8245 if (ls_scan2 ==
S_END)
8448 if (hash_list ==
NULL)
8461 buildlist->
proc.
buildlist.upddel_oid_locator_ehids = hash_list;
8466 if (hash_list !=
NULL)
8468 for (--idx; idx >= 0; idx--)
8493 bool save_interrupted;
8528 int idx, idx2, idx3;
8531 int *mvcc_extra_assign_reev =
NULL;
8533 if (reev_classes ==
NULL || num_reev_classes <= 0)
8539 for (access_spec = aptr->
spec_list; access_spec !=
NULL; access_spec = access_spec->
next)
8541 for (idx = num_reev_classes - 1; idx >= 0; idx--)
8546 for (idx2 = 0; idx2 < num_classes; idx2++)
8549 for (idx3 = classes[idx2].num_extra_assign_reev - 1; idx3 >= 0; idx3--)
8551 if (mvcc_extra_assign_reev[idx3] == reev_classes[idx].class_index)
8561 if (idx2 < num_classes)
8567 if (scan_elem ==
NULL)
8569 scan_elem = scan_start = &reev_classes[idx];
8573 scan_elem->
next = &reev_classes[idx];
8574 scan_elem = scan_elem->
next;
8620 int idx, idx2, idx3;
8622 if (reev_data ==
NULL)
8631 if (num_reev_classes == 0)
8636 if (mvcc_reev_classes ==
NULL)
8644 if (cond_reev_classes ==
NULL)
8649 for (idx = 0; idx < num_reev_classes; idx++)
8651 cond_reev_class = &cond_reev_classes[idx];
8652 cond_reev_class->
class_index = mvcc_reev_indexes[idx];
8654 cond_reev_class->inst_oid =
NULL;
8655 cond_reev_class->rest_attrs =
NULL;
8656 cond_reev_class->rest_regu_list =
NULL;
8657 cond_reev_class->next =
NULL;
8659 for (idx = 0; idx < num_classes; idx++)
8661 cls = &classes[idx];
8662 int_cls = &internal_classes[idx];
8675 for (idx3 = 0; idx3 < num_reev_classes; idx3++)
8694 reev_data->
vd = &xasl_state->
vd;
8697 assigns, mvcc_reev_assigns) !=
NO_ERROR)
8702 *mvcc_reev_classes = cond_reev_classes;
8707 if (cond_reev_classes !=
NULL)
8711 for (idx = 0; idx < num_classes; idx++)
8713 int_cls = &internal_classes[idx];
8719 *mvcc_reev_classes =
NULL;
8751 int savepoint_used = 0;
8752 int satisfies_constraints;
8758 int class_oid_cnt = 0, class_oid_idx = 0;
8759 int mvcc_reev_class_cnt = 0, mvcc_reev_class_idx = 0;
8760 bool scan_open =
false;
8761 int should_delete = 0;
8802 &mvcc_reev_assigns, has_delete);
8813 COPY_OID (&class_instance_lock_info.
class_oid, (*((*update).classes)).class_oid);
8815 p_class_instance_lock_info = &class_instance_lock_info;
8823 if (p_class_instance_lock_info && p_class_instance_lock_info->
instances_locked)
8826 need_locking =
false;
8831 need_locking =
true;
8907 if (satisfies_constraints ==
V_ERROR)
8921 current_op_type = op_type;
8925 for (class_oid_idx = 0; class_oid_idx < class_oid_cnt; vallist = vallist->
next->
next, class_oid_idx++)
8929 valp = vallist->
val;
8961 for (class_oid_idx = 0, mvcc_reev_class_idx = 0; class_oid_idx < class_oid_cnt;
8962 vallist = vallist->
next->
next, class_oid_idx++)
8964 upd_cls = &update->
classes[class_oid_idx];
8965 internal_class = &internal_classes[class_oid_idx];
8967 if (mvcc_reev_class_cnt && mvcc_reev_classes[mvcc_reev_class_idx].class_index == class_oid_idx)
8969 mvcc_reev_class = &mvcc_reev_classes[mvcc_reev_class_idx++];
8973 mvcc_reev_class =
NULL;
8977 valp = vallist->
val;
8984 internal_class->oid =
NULL;
8988 if (mvcc_reev_class !=
NULL)
8990 mvcc_reev_class->inst_oid = internal_class->oid;
9007 && (!
OID_EQ (&internal_class->prev_class_oid, class_oid)
9009 && internal_class->scan_cache !=
NULL && internal_class->scan_cache->m_index_stats ==
NULL)))
9014 if (error !=
NO_ERROR || internal_class->class_hfid ==
NULL)
9022 if (mvcc_reev_class !=
NULL)
9032 if (!
OID_ISNULL (&internal_class->prev_class_oid) && internal_class->is_attr_info_inited)
9035 internal_class->is_attr_info_inited =
false;
9042 internal_class->is_attr_info_inited =
true;
9046 if (internal_class->num_lob_attrs)
9048 internal_class->crt_del_lob_info =
9050 if (internal_class->crt_del_lob_info ==
NULL)
9057 internal_class->crt_del_lob_info =
NULL;
9066 if (internal_class->crt_del_lob_info)
9069 DEL_LOB_INFO *crt_del_lob_info = internal_class->crt_del_lob_info;
9091 for (i = 0; i < internal_class->num_lob_attrs; i++)
9131 else if (force_count)
9149 for (; mvcc_reev_class_idx < mvcc_reev_class_cnt; mvcc_reev_class_idx++)
9151 mvcc_reev_class = &mvcc_reev_classes[mvcc_reev_class_idx];
9154 valp = vallist->
val;
9171 mvcc_reev_class->inst_oid =
db_get_oid (valp);
9192 if (class_oid && !
OID_EQ (&mvcc_reev_class->cls_oid, class_oid))
9214 vallist = vallist->
next;
9218 for (assign_idx = 0; assign_idx < update->
num_assigns; assign_idx++)
9222 assign = &update->
assigns[assign_idx];
9223 class_oid_idx = assign->
cls_idx;
9224 internal_class = &internal_classes[class_oid_idx];
9225 attr_info = &internal_class->attr_info;
9226 upd_cls = &update->
classes[class_oid_idx];
9227 oid = internal_class->oid;
9233 vallist = vallist->
next;
9238 if (mvcc_reev_assigns !=
NULL)
9240 mvcc_reev_assigns[assign_idx].
att_id = attr_id;
9250 vallist = vallist->
next;
9261 for (class_oid_idx = class_oid_cnt - 1, mvcc_reev_class_idx = mvcc_reev_class_cnt - 1; class_oid_idx >= 0;
9264 internal_class = &internal_classes[class_oid_idx];
9265 upd_cls = &update->
classes[class_oid_idx];
9267 if (mvcc_reev_class_cnt && mvcc_reev_classes[mvcc_reev_class_idx].class_index == class_oid_idx)
9269 mvcc_reev_class = &mvcc_reev_classes[mvcc_reev_class_idx++];
9273 mvcc_reev_class =
NULL;
9275 mvcc_upddel_reev_data.
curr_upddel = mvcc_reev_class;
9278 oid = internal_class->oid;
9286 pcontext = &internal_class->context;
9295 mvcc_upddel_reev_data.
curr_assigns = internal_class->mvcc_reev_assigns;
9296 mvcc_upddel_reev_data.
curr_attrinfo = &internal_class->attr_info;
9301 &force_count,
false, repl_info, internal_class->needs_pruning, pcontext,
9337 if (ls_scan !=
S_END)
9342 if (xb_scan !=
S_END)
9347 for (s = 0; s < class_oid_cnt; s++)
9349 internal_class = &internal_classes[s];
9350 upd_cls = &update->
classes[s];
9354 if (internal_class->needs_pruning)
9376 if (internal_classes)
9382 if (mvcc_reev_classes !=
NULL)
9385 mvcc_reev_classes =
NULL;
9387 if (mvcc_reev_assigns !=
NULL)
9390 mvcc_reev_assigns =
NULL;
9409 class_oid = update->class_oid;
9412 for (s = 0; s < update->
num_classes; s++, class_oid++)
9417 "qexec_execute_update: qexec_clear_list_cache_by_class failed for class { %d %d %d }\n",
9435 if (del_lob_info_list !=
NULL)
9440 if (mvcc_reev_classes !=
NULL)
9443 mvcc_reev_classes =
NULL;
9445 if (mvcc_reev_assigns !=
NULL)
9448 mvcc_reev_assigns =
NULL;
9461 if (internal_classes)
9511 if (!it.second.is_unique ())
9561 if (!it.second.is_unique ())
9563 char *index_name =
NULL;
9575 if (index_name !=
NULL)
9605 #define MIN_NUM_ROWS_FOR_MULTI_DELETE 20 9617 int savepoint_used = 0;
9618 int class_oid_cnt = 0, class_oid_idx = 0;
9619 int force_count = 0;
9622 int mvcc_reev_class_cnt = 0, mvcc_reev_class_idx = 0;
9624 bool scan_open =
false;
9664 NULL, &mvcc_reev_classes,
NULL, 0);
9675 COPY_OID (&class_instance_lock_info.
class_oid, (*((*delete_).classes)).class_oid);
9677 p_class_instance_lock_info = &class_instance_lock_info;
9685 if (p_class_instance_lock_info && p_class_instance_lock_info->
instances_locked)
9688 need_locking =
false;
9693 need_locking =
true;
9746 for (class_oid_idx = 0, mvcc_reev_class_idx = 0;
9747 class_oid_idx < class_oid_cnt || mvcc_reev_class_idx < mvcc_reev_class_cnt;
9748 val_list = val_list->
next->
next, class_oid_idx++)
9750 if (mvcc_reev_class_idx < mvcc_reev_class_cnt
9751 && mvcc_reev_classes[mvcc_reev_class_idx].class_index == class_oid_idx)
9753 mvcc_reev_class = &mvcc_reev_classes[mvcc_reev_class_idx++];
9757 mvcc_reev_class =
NULL;
9760 valp = val_list->
val;
9767 if (class_oid_idx < class_oid_cnt)
9769 internal_class = &internal_classes[class_oid_idx];
9771 internal_class->oid =
NULL;
9785 if (class_oid_idx < class_oid_cnt)
9793 if (class_oid_idx < class_oid_cnt)
9795 internal_class = &internal_classes[class_oid_idx];
9797 internal_class->
oid = oid;
9800 && (internal_class->class_oid ==
NULL || !
OID_EQ (internal_class->class_oid, class_oid)))
9802 query_class = &delete_->
classes[class_oid_idx];
9814 if (internal_class->num_lob_attrs)
9816 internal_class->crt_del_lob_info =
9818 if (internal_class->crt_del_lob_info ==
NULL)
9825 internal_class->crt_del_lob_info =
NULL;
9830 if (mvcc_reev_class !=
NULL)
9833 if (class_oid && !
OID_EQ (&mvcc_reev_class->cls_oid, class_oid))
9854 for (class_oid_idx = 0, mvcc_reev_class_idx = 0; class_oid_idx < class_oid_cnt; class_oid_idx++)
9856 internal_class = &internal_classes[class_oid_idx];
9857 oid = internal_class->oid;
9858 class_oid = internal_class->class_oid;
9860 if (mvcc_reev_class_cnt && mvcc_reev_classes[mvcc_reev_class_idx].class_index == class_oid_idx)
9862 mvcc_reev_class = &mvcc_reev_classes[mvcc_reev_class_idx++];
9866 mvcc_reev_class =
NULL;
9868 mvcc_upddel_reev_data.
curr_upddel = mvcc_reev_class;
9875 if (internal_class->crt_del_lob_info)
9878 DEL_LOB_INFO *crt_del_lob_info = internal_class->crt_del_lob_info;
9899 for (i = 0; i < internal_class->num_lob_attrs; i++)
9926 op_type, internal_class->scan_cache, &force_count,
false,
9937 else if (force_count)
9945 valp = val_list->
val;
9964 val_list = val_list->
next;
9967 if (ls_scan !=
S_END)
9972 if (xb_scan !=
S_END)
9978 for (s = 0; s < class_oid_cnt; s++)
9980 internal_class = internal_classes + s;
9981 query_class = delete_->
classes + s;
9982 if (internal_classes[s].needs_pruning)
10000 if (internal_classes)
10006 if (mvcc_reev_classes !=
NULL)
10009 mvcc_reev_classes =
NULL;
10017 if (savepoint_used)
10028 class_oid = XASL_DELETE_CLASS_OID (xasl);
10031 for (s = 0; s < XASL_DELETE_NO_CLASSES (xasl); s++, class_oid++)
10036 "qexec_execute_delete: qexec_clear_list_cache_by_class failed for class { %d %d %d }\n",
10053 if (del_lob_info_list !=
NULL)
10058 if (internal_classes)
10064 if (mvcc_reev_classes !=
NULL)
10067 mvcc_reev_classes =
NULL;
10075 if (savepoint_used)
10116 return del_lob_info;
10143 DEL_LOB_INFO *del_lob_info_list = *del_lob_info_list_ptr;
10147 del_lob_info_list = *del_lob_info_list_ptr;
10149 if (del_lob_info_list ==
NULL)
10153 *del_lob_info_list_ptr = del_lob_info_list;
10154 return del_lob_info_list;
10158 for (del_lob_info = del_lob_info_list; del_lob_info; del_lob_info = del_lob_info->
next)
10163 return del_lob_info;
10173 del_lob_info->
next = del_lob_info_list;
10174 del_lob_info_list = del_lob_info;
10175 *del_lob_info_list_ptr = del_lob_info_list;
10177 return del_lob_info_list;
10195 if (!del_lob_info_list_ptr)
10201 del_lob_info_list = *del_lob_info_list_ptr;
10202 if (!del_lob_info_list)
10208 del_lob_info = del_lob_info_list;
10209 while (del_lob_info)
10211 next_del_lob_info = del_lob_info->
next;
10216 del_lob_info = next_del_lob_info;
10218 *del_lob_info_list_ptr =
NULL;
10251 int force_count = 0;
10254 OID class_oid, pruned_oid;
10256 bool is_global_index;
10257 HFID class_hfid, pruned_hfid;
10262 *removed_count = 0;
10272 if (copyarea ==
NULL)
10288 COPY_OID (&class_oid, &attr_info->class_oid);
10290 local_scan_cache = scan_cache;
10295 is_global_index =
false;
10296 index = &(index_attr_info->last_classrepr->indexes[
i]);
10308 COPY_OID (&pruned_oid, &class_oid);
10314 if (key_dbvalue ==
NULL)
10321 if (pcontext ==
NULL)
10341 COPY_OID (&attr_info->inst_oid, &unique_oid);
10352 if (pruning_cache ==
NULL)
10364 local_scan_cache = &pruning_cache->
scan_cache;
10378 local_op_type, local_scan_cache, &force_count,
false,
10390 else if (force_count != 0)
10392 assert (force_count == 1);
10393 *removed_count += force_count;
10412 if (key_dbvalue == &dbvalue)
10415 key_dbvalue =
NULL;
10419 if (copyarea !=
NULL)
10430 if (key_dbvalue == &dbvalue)
10433 key_dbvalue =
NULL;
10436 if (copyarea !=
NULL)
10482 bool found_duplicate =
false;
10488 bool is_global_index =
false;
10492 assert (pruned_partition_scan_cache !=
NULL);
10509 if (copyarea ==
NULL)
10522 assert (index_attr_info->last_classrepr !=
NULL);
10524 for (i = 0; i < idx_info->
num_btids && !found_duplicate; ++
i)
10526 index = &(index_attr_info->last_classrepr->indexes[
i]);
10538 COPY_OID (&class_oid, &attr_info->class_oid);
10539 is_global_index =
false;
10543 if (key_dbvalue ==
NULL)
10550 if (pcontext ==
NULL)
10569 COPY_OID (&attr_info->inst_oid, &unique_oid);
10579 if (pruning_cache ==
NULL)
10591 *pruned_partition_scan_cache = &pruning_cache->
scan_cache;
10605 found_duplicate =
true;
10606 COPY_OID (unique_oid_p, &unique_oid);
10623 if (key_dbvalue == &dbvalue)
10626 key_dbvalue =
NULL;
10630 if (copyarea !=
NULL)
10641 if (key_dbvalue == &dbvalue)
10644 key_dbvalue =
NULL;
10647 if (copyarea !=
NULL)
10682 int satisfies_constraints;
10690 bool need_clear = 0;
10698 local_scan_cache = scan_cache;
10702 pruning_type, pcontext, &unique_oid, op_type);
10706 goto exit_on_error;
10724 goto exit_on_error;
10745 goto exit_on_error;
10755 if (satisfies_constraints ==
V_ERROR)
10758 goto exit_on_error;
10761 if (satisfies_constraints !=
V_TRUE)
10766 goto exit_on_error;
10781 goto exit_on_error;
10791 goto exit_on_error;
10798 goto exit_on_error;
10806 LC_FLUSH_UPDATE, local_op_type, local_scan_cache, force_count,
false, repl_info,
10816 goto exit_on_error;
10844 if (pr_type !=
NULL)
10848 switch (_setjmp (buf.
env))
10890 bool attr_info_inited =
false;
10891 volatile bool index_attr_info_inited =
false;
10892 volatile bool odku_attr_info_inited =
false;
10894 int savepoint_used = 0;
10895 int satisfies_constraints;
10897 bool scan_cache_inited =
false;
10898 int scan_cache_op_type = 0;
10899 int force_count = 0;
10900 int num_default_expr = 0;
10904 volatile int n_indexes = 0;
10908 int is_autoincrement_set = 0;
10909 int month, day, year, hour, minute, second, millisecond;
10910 DB_VALUE insert_val, format_val, lang_val;
10911 char *lang_str =
NULL;
10914 bool has_user_format;
10964 savepoint_used = 1;
10973 pcontext = &context;
10988 index_attr_info_inited =
true;
10989 if (odku_assignments !=
NULL)
10996 odku_attr_info_inited =
true;
11004 attr_info_inited =
true;
11005 n_indexes = attr_info.last_classrepr->n_indexes;
11009 if (num_default_expr < 0)
11011 num_default_expr = 0;
11015 for (k = 0; k < num_default_expr; k++)
11028 if (new_val ==
NULL)
11033 insert->
vals[k] = new_val;
11045 const char *t_source, *t_dest;
11046 int len_source, len_dest;
11050 len_source = (int)
strlen (t_source);
11051 len_dest = (int)
strlen (t_dest);
11065 TZ_REGION system_tz_region, session_tz_region;
11088 TZ_REGION system_tz_region, session_tz_region;
11137 strcat (temp,
"@");
11191 has_user_format = 1;
11196 has_user_format = 0;
11208 result_domain =
NULL;
11221 result_domain = attr->
domain;
11224 error =
db_to_char (&insert_val, &format_val, &lang_val, insert->
vals[k], result_domain);
11226 if (has_user_format)
11283 scan_cache_inited =
true;
11289 specp->grouped_scan,
true, &specp->s_id, xasl_state->
query_id,
S_SELECT,
false,
11292 if (savepoint_used)
11305 for (k = num_default_expr, vallist = s_id->
val_list->
valp; k < val_no; k++, vallist = vallist->next)
11313 insert->
vals[k] = vallist->
val;
11321 if (satisfies_constraints ==
V_ERROR)
11338 for (k = 0; k < val_no; ++k)
11370 int removed_count = 0;
11372 assert (index_attr_info_inited ==
true);
11376 pcontext, &removed_count) !=
NO_ERROR)
11388 scan_cache_op_type, &scan_cache, &attr_info, &index_attr_info,
11389 &idx_info, insert->
pruning_type, pcontext, &force_count);
11395 if (force_count != 0)
11397 assert (force_count == 1);
11407 scan_cache_op_type, &scan_cache, &force_count,
false,
11416 COPY_OID (&(attr_info.class_oid), &class_oid);
11421 assert (force_count == 1);
11424 && is_autoincrement_set > 0)
11439 if (ls_scan !=
S_END)
11445 if (xb_scan !=
S_END)
11461 scan_cache_inited =
true;
11474 k < val_no; k++, regu_list = regu_list->next, vallist = vallist->
next)
11486 insert->
vals[k] = valp;
11494 if (satisfies_constraints ==
V_ERROR)
11512 for (k = 0; k < val_no; ++k)
11541 int removed_count = 0;
11542 assert (index_attr_info_inited ==
true);
11559 scan_cache_op_type, &scan_cache, &attr_info, &index_attr_info,
11560 &idx_info, insert->
pruning_type, pcontext, &force_count);
11568 assert (force_count == 1);
11573 if (force_count == 0)
11576 scan_cache_op_type, &scan_cache, &force_count,
false,
11586 assert (force_count == 1);
11588 && is_autoincrement_set > 0)
11606 assert (force_count == 1);
11607 if (force_count != 1)
11622 if (pcontext !=
NULL)
11637 if (!it.second.is_unique ())
11654 if (func_indx_preds)
11658 if (index_attr_info_inited)
11662 if (attr_info_inited)
11666 if (scan_cache_inited)
11670 if (pcontext !=
NULL)
11676 if (savepoint_used)
11687 COPY_OID (&class_oid, &XASL_INSERT_CLASS_OID (xasl));
11693 "qexec_execute_insert: qexec_clear_list_cache_by_class failed for class { %d %d %d }\n",
11700 for (k = 0; k < num_default_expr; k++)
11715 for (k = 0; k < num_default_expr; k++)
11722 if (func_indx_preds)
11726 if (index_attr_info_inited)
11730 if (attr_info_inited)
11734 if (odku_attr_info_inited)
11738 if (scan_cache_inited)
11743 if (savepoint_used)
11747 if (pcontext !=
NULL)
11799 int dead_end =
false;
11800 int unqualified_dead_end =
false;
11858 if (xptr->status == XASL_CLEARED || xptr->status == XASL_INITIALIZED)
11867 if (xptr->status != XASL_SUCCESS)
11880 int cache_pred_end_needed =
false;
11881 int cache_rest_end_needed =
false;
11882 int scan_cache_end_needed =
false;
11892 if (mvcc_snapshot ==
NULL)
11901 scan_cache_end_needed =
true;
11908 scan =
locator_get_object (thread_p, &dbvaloid, &cls_oid, &oRec, &scan_cache, scan_operation_type, lock_mode,
11926 unqualified_dead_end =
true;
11947 bool found =
false;
11951 specp = specp->
next)
11953 PARTITION_SPEC_TYPE *current =
NULL;
11965 PARTITION_SPEC_TYPE *partition_spec =
NULL;
11973 for (partition_spec = specp->parts; partition_spec !=
NULL; partition_spec = partition_spec->next)
11986 current = specp->parts;
11988 while (current !=
NULL)
11990 if (
OID_EQ (¤t->oid, &cls_oid))
11995 current = current->
next;
12010 unqualified_dead_end =
true;
12024 cache_pred_end_needed =
true;
12033 cache_rest_end_needed =
true;
12101 if (cache_pred_end_needed)
12105 if (cache_rest_end_needed)
12109 if (scan_cache_end_needed)
12122 if (unqualified_dead_end || fetch->
ql_flag ==
true)
12176 else if (ev_res2 !=
V_TRUE)
12236 ATTR_ID attrid,
int n_increment,
int pruning_type)
12239 int attr_info_inited = 0;
12241 bool scan_cache_inited =
false;
12242 HEAP_ATTRVALUE *value =
NULL;
12253 attr_info_inited = 1;
12261 scan_cache_inited =
true;
12285 value->do_increment = n_increment;
12289 OID copy_oid = *oid;
12296 assert (force_count == 0);
12312 OID *o = class_oid;
12314 "qexec_execute_increment: qexec_clear_list_cache_by_class failed for class { %d %d %d }\n",
12323 if (attr_info_inited)
12328 if (scan_cache_inited)
12376 *class_oid = class_oid_buf;
12378 for (; scan_ptr !=
NULL; scan_ptr = scan_ptr->
scan_ptr)
12381 for (specp = scan_ptr->
spec_list; specp; specp = specp->
next)
12392 if (!specp->pruned)
12402 PARTITION_SPEC_TYPE *part_spec =
NULL;
12403 for (part_spec = specp->parts; part_spec !=
NULL; part_spec = part_spec->next)
12405 if (
OID_EQ (&part_spec->oid, class_oid))
12408 *class_hfid = part_spec->hfid;
12420 && specp->s_id.mvcc_select_lock_needed)
12446 bool subtransaction_started =
false;
12447 OID last_cached_class_oid;
12451 bool scan_cache_inited =
false;
12457 bool clear_list_id =
false;
12460 bool sysop_started =
false;
12461 bool in_instant_lock_mode;
12473 incr_info () =
default;
12474 incr_info (
const incr_info & other) =
default;
12476 std::vector<incr_info> all_incr_info;
12477 std::vector<bool> all_skipped;
12478 size_t incr_info_index = 0;
12479 size_t skipped_index = 0;
12494 p_mvcc_reev_data = &mvcc_reev_data;
12497 clear_list_id =
true;
12501 in_instant_lock_mode =
true;
12512 for (selupd = list; selupd; selupd = selupd->
next)
12514 for (outptr = selupd->select_list; outptr; outptr = outptr->
next)
12516 incr_info crt_incr_info;
12520 goto exit_on_error;
12528 && (varptr->value.arithptr->opcode ==
T_INCR || varptr->value.arithptr->opcode ==
T_DECR)))
12530 goto exit_on_error;
12533 || varptr->value.arithptr->rightptr->type !=
TYPE_CONSTANT)
12535 goto exit_on_error;
12539 rightvalp = varptr->value.arithptr->value;
12544 clear_list_id =
false;
12545 all_skipped.push_back (
true);
12548 crt_incr_info.m_oid = *
db_get_oid (rightvalp);
12555 clear_list_id =
false;
12556 all_skipped.push_back (
true);
12564 goto exit_on_error;
12566 crt_incr_info.m_attrid =
db_get_int (thirdvalp);
12568 crt_incr_info.m_n_increment = (varptr->value.arithptr->opcode ==
T_INCR ? 1 : -1);
12571 bool found =
false;
12573 &crt_incr_info.m_class_oid, &crt_incr_info.m_class_hfid,
12574 &crt_incr_info.m_ptype, &found);
12577 goto exit_on_error;
12584 goto exit_on_error;
12587 if (p_mvcc_reev_data !=
NULL)
12590 if (!
OID_EQ (&last_cached_class_oid, &crt_incr_info.m_class_oid) && scan_cache_inited ==
true)
12593 scan_cache_inited =
false;
12596 if (scan_cache_inited ==
false)
12599 &crt_incr_info.m_class_oid,
false,
false, mvcc_snapshot) !=
NO_ERROR)
12601 goto exit_on_error;
12603 scan_cache_inited =
true;
12604 COPY_OID (&last_cached_class_oid, &crt_incr_info.m_class_oid);
12617 goto exit_on_error;
12624 "qexec_execute_selupd_list: lock(X_LOCK) timed out " 12625 "for OID { %d %d %d } class OID { %d %d %d }\n",
OID_AS_ARGS (&crt_incr_info.m_oid),
12628 all_skipped.push_back (
true);
12639 "qexec_execute_selupd_list: skip for OID " 12640 "{ %d %d %d } class OID { %d %d %d } error_id %d\n",
12643 all_skipped.push_back (
true);
12651 "qexec_execute_selupd_list: skip for OID " 12652 "{ %d %d %d } class OID { %d %d %d } error_id %d\n",
OID_AS_ARGS (&crt_incr_info.m_oid),
12654 all_skipped.push_back (
true);
12660 clear_list_id =
false;
12670 all_incr_info.push_back (crt_incr_info);
12671 all_skipped.push_back (
false);
12676 sysop_started =
true;
12680 assert (in_instant_lock_mode);
12683 if (need_ha_replication)
12685 repl_start_flush_mark (thread_p);
12692 subtransaction_started =
true;
12695 for (selupd = list; selupd; selupd = selupd->
next)
12697 for (outptr = selupd->select_list; outptr; outptr = outptr->
next)
12699 if (all_skipped[skipped_index++])
12704 const incr_info & crt_incr_info = all_incr_info[incr_info_index++];
12706 &crt_incr_info.m_class_hfid, crt_incr_info.m_attrid, crt_incr_info.m_n_increment,
12707 crt_incr_info.m_ptype) !=
NO_ERROR)
12709 goto exit_on_error;
12713 assert (skipped_index == all_skipped.size ());
12714 assert (incr_info_index == all_incr_info.size ());
12716 if (scan_cache_inited ==
true)
12719 scan_cache_inited =
false;
12722 if (subtransaction_started && need_ha_replication)
12725 repl_end_flush_mark (thread_p,
false);
12732 assert (subtransaction_started);
12735 assert (in_instant_lock_mode);
12742 in_instant_lock_mode =
false;
12747 if (subtransaction_started)
12753 if (in_instant_lock_mode)
12757 in_instant_lock_mode =
false;
12779 if (scan_cache_inited ==
true)
12782 scan_cache_inited =
false;
12785 if (subtransaction_started && need_ha_replication)
12788 repl_end_flush_mark (thread_p,
true);
12794 sysop_started =
false;
12856 goto exit_on_error;
12868 goto exit_on_error;
12874 goto exit_on_error;
12880 goto exit_on_error;
12885 goto exit_on_error;
12916 switch (xasl->
type)
12924 if (type_list.
domp)
12933 if (t_list_id ==
NULL)
12935 if (type_list.
domp)
12946 if (type_list.
domp)
12975 buildlist->upddel_oid_locator_ehids =
NULL;
12988 if (type_list.
domp)
13006 if (t_list_id ==
NULL)
13008 if (type_list.
domp)
13019 if (type_list.
domp)
13049 if (type_list.
domp)
13058 if (t_list_id ==
NULL)
13060 if (type_list.
domp)
13071 if (type_list.
domp)
13124 goto exit_on_error;
13203 else if (ev_res !=
V_TRUE 13227 if (t_list_id ==
NULL)
13229 if (type_list.
domp)
13237 if (type_list.
domp)
13258 switch (tpldescr_status)
13333 bool distinct_needed;
13338 #if defined (ENABLE_COMPOSITE_LOCK) 13350 switch (xasl->
type)
13394 if (distinct_needed)
13416 distinct_needed =
false;
13464 switch (xasl->
type)
13524 UINT64 old_fetches = 0, old_ioreads = 0;
13551 xasl->xasl_stats.fetches += perfmon_get_from_statistic (thread_p,
PSTAT_PB_NUM_FETCHES) - old_fetches;
13552 xasl->xasl_stats.ioreads += perfmon_get_from_statistic (thread_p,
PSTAT_PB_NUM_IOREADS) - old_ioreads;
13576 *empty_result =
false;
13589 if (cmp_with_zero !=
DB_GT && cmp_with_zero !=
DB_EQ)
13611 if (cmp_with_zero ==
DB_GT)
13616 else if (cmp_with_zero ==
DB_EQ)
13618 *empty_result =
true;
13652 int multi_upddel =
false;
13656 bool iscan_oid_order, force_select_lock =
false;
13657 bool has_index_scan =
false;
13658 int old_wait_msecs, wait_msecs;
13660 bool empty_result =
false;
13661 bool scan_immediately_stop =
false;
13663 bool instant_lock_mode_started =
false;
13664 bool mvcc_select_lock_needed;
13665 bool old_no_logging;
13675 goto exit_on_error;
13678 if (empty_result ==
true)
13687 scan_immediately_stop =
true;
13692 switch (xasl->
type)
13760 old_no_logging = thread_p->no_logging;
13764 thread_p->no_logging = old_no_logging;
13857 xasl->status = XASL_SUCCESS;
13874 instant_lock_mode_started =
true;
13875 force_select_lock =
true;
13900 agg_p->accumulator_domain.value_dom =
NULL;
13901 agg_p->accumulator_domain.value2_dom =
NULL;
13914 agg_p->accumulator_domain.value_dom =
NULL;
13915 agg_p->accumulator_domain.value2_dom =
NULL;
13923 #if defined (ENABLE_COMPOSITE_LOCK) 13940 for (xptr = xasl; xptr; xptr = xptr->
scan_ptr)
13943 merge_infop =
NULL;
13962 if (inner_xasl == xptr2)
13971 if (inner_xasl->list_id->type_list.type_cnt > 0 && inner_xasl->list_id->tuple_cnt == 0)
13974 if (outer_xasl == xptr2)
13988 if (xptr2->status == XASL_CLEARED || xptr2->status == XASL_INITIALIZED)
14002 if (xptr2->status != XASL_SUCCESS)
14044 for (xptr = xasl; xptr; xptr = xptr->
scan_ptr)
14047 for (; specp; specp = specp->
next)
14052 fixed_scan_xasl = xptr;
14055 has_index_scan =
true;
14060 if (has_index_scan)
14071 fixed_scan_xasl = xptr;
14074 has_index_scan =
true;
14081 if (has_index_scan)
14084 fixed_scan_xasl =
NULL;
14089 fixed_scan_xasl =
NULL;
14094 fixed_scan_xasl =
NULL;
14099 fixed_scan_xasl =
NULL;
14107 fixed_scan_xasl =
NULL;
14112 for (xptr = xasl, level = 0; xptr; xptr = xptr->
scan_ptr, level++)
14117 for (spec_level = 0; spec_level < 2; ++spec_level)
14119 for (specp = spec_ptr[spec_level]; specp; specp = specp->
next)
14121 specp->fixed_scan = (xptr == fixed_scan_xasl);
14131 specp->grouped_scan =
false;
14137 specp->grouped_scan =
false;
14144 specp->grouped_scan =
false;
14150 specp->grouped_scan =
false;
14153 if (specp->grouped_scan && specp->fixed_scan ==
false)
14155 specp->grouped_scan =
false;
14161 if (level == 0 && spec_level == 1)
14164 force_select_lock, specp->fixed_scan, specp->grouped_scan,
14166 scan_immediately_stop, &mvcc_select_lock_needed) !=
NO_ERROR)
14174 && mvcc_select_lock_needed)
14185 specp->grouped_scan =
false;
14186 iscan_oid_order =
false;
14190 specp->fixed_scan, specp->grouped_scan, iscan_oid_order, &specp->s_id,
14192 &mvcc_select_lock_needed) !=
NO_ERROR)
14200 && mvcc_select_lock_needed)
14212 if (func_vector ==
NULL)
14227 for (xptr = xasl, level = 0; xptr; xptr = xptr->
scan_ptr, level++)
14273 qp_scan = (*func_vector[0]) (thread_p, xasl, xasl_state, &tplrec, &func_vector[1]);
14285 for (xptr = xasl, level = 0; xptr; xptr = xptr->
scan_ptr, level++)
14289 for (spec_level = 0; spec_level < 2; ++spec_level)
14291 for (specp = spec_ptr[spec_level]; specp; specp = specp->
next)
14316 UINT64 old_fetches = 0, old_ioreads = 0;
14317 XASL_STATS *xasl_stats;
14353 xasl_stats->fetches = perfmon_get_from_statistic (thread_p,
PSTAT_PB_NUM_FETCHES) - old_fetches;
14354 xasl_stats->ioreads = perfmon_get_from_statistic (thread_p,
PSTAT_PB_NUM_IOREADS) - old_ioreads;
14390 instant_lock_mode_started =
false;
14400 if (instant_lock_mode_started ==
true)
14403 instant_lock_mode_started =
false;
14459 #if defined (ENABLE_COMPOSITE_LOCK) 14506 || xasl->topn_items !=
NULL))
14540 if (instant_lock_mode_started ==
true)
14554 for (xptr = xasl; xptr; xptr = xptr->
scan_ptr)
14566 xasl->status = XASL_SUCCESS;
14574 #if defined(SERVER_MODE) 14582 if (instant_lock_mode_started ==
true)
14593 for (xptr = xasl, level = 0; xptr; xptr = xptr->
scan_ptr, level++)
14597 for (spec_level = 0; spec_level < 2; ++spec_level)
14599 for (specp = spec_ptr[spec_level]; specp; specp = specp->
next)
14628 #if defined (ENABLE_COMPOSITE_LOCK) 14633 xasl->status = XASL_FAILURE;
14656 #define QP_MAX_RE_EXECUTES_UNDER_DEADLOCKS 10 14667 struct tm *c_time_struct, tm_val;
14670 #if defined(CUBRID_DEBUG) 14671 static int trace = -1;
14672 static FILE *fp =
NULL;
14678 struct drand48_data *rand_buf_p;
14680 #if defined (SERVER_MODE) 14681 int qlist_enter_count;
14682 #endif // SERVER_MODE 14684 #if defined(ENABLE_SYSTEMTAP) 14685 const char *query_str =
NULL;
14686 int client_id = -1;
14687 const char *db_user =
NULL;
14699 #if defined(CUBRID_DEBUG) 14701 if (!qdump_check_xasl_tree (xasl))
14709 printf (
"<NULL XASL tree>\n");
14721 if (!strcmp (file,
"stdout"))
14725 else if (!strcmp (file,
"stderr"))
14731 fp = fopen (file,
"a");
14734 fprintf (stderr,
"Error: QUERY_TRACE_FILE '%s'\n", file);
14751 strftime (str, 19,
"%x %X", localtime_r (&loc, &tm_val));
14753 (xasl->sql_hash_text ? xasl->sql_hash_text :
"<NULL>"));
14759 #if defined (SERVER_MODE) 14760 qlist_enter_count = thread_p->m_qlist_count;
14765 #endif // SERVER_MODE 14770 #if defined(ENABLE_SYSTEMTAP) 14774 query_str = (query_str ? query_str :
"unknown");
14775 db_user = (db_user ? db_user :
"unknown");
14777 CUBRID_QUERY_EXEC_START (query_str, query_id, client_id, db_user);
14786 c_time_struct = localtime_r (&sec, &tm_val);
14790 if (c_time_struct !=
NULL)
14793 c_time_struct->tm_year + 1900, c_time_struct->tm_hour, c_time_struct->tm_min,
14794 c_time_struct->tm_sec, millisec);
14798 lrand48_r (rand_buf_p, &xasl_state.
vd.
lrand);
14799 drand48_r (rand_buf_p, &xasl_state.
vd.
drand);
14818 re_execute =
false;
14827 #if defined(SERVER_MODE) 14830 qexec_set_xasl_trace_to_session (thread_p, xasl);
14845 snprintf (buf, 511,
"Query execution failure #%d.", xasl_state.
qp_xasl_line);
14881 while (re_execute);
14891 #if defined(SERVER_MODE) 14901 #if defined(CUBRID_DEBUG) 14910 elapsed = (float) (tv_diff.tv_sec) * 1000000;
14911 elapsed += (float) tv_diff.tv_usec;
14912 elapsed /= 1000000;
14915 strftime (str, 19,
"%x %X", localtime_r (&loc, &tm_val));
14924 #if defined (SERVER_MODE) 14932 assert (thread_p->m_qlist_count == qlist_enter_count + 1);
14937 assert (thread_p->m_qlist_count == qlist_enter_count);
14939 #endif // SERVER_MODE 14941 #if defined(ENABLE_SYSTEMTAP) 14942 CUBRID_QUERY_EXEC_END (query_str, query_id, client_id, db_user, (
er_errid () !=
NO_ERROR));
14947 #if defined(CUBRID_DEBUG) 14953 get_xasl_dumper_linked_in ()
14961 #if defined(SERVER_MODE) 14962 #if defined (ENABLE_UNUSED_FUNCTION) 14970 tranid_compare (
const void *t1,
const void *t2)
14972 return *((
int *) t1) - *((
int *) t2);
15021 if (!regu_var || !regu_var->value.arithptr)
15063 regu_var->value.dbval = *set_dbval;
15100 int level_value = 0, isleaf_value = 0, iscycle_value = 0;
15101 char *son_index =
NULL, *father_index =
NULL;
15102 int len_son_index = 0, len_father_index = 0;
15103 int index = 0, index_father = 0;
15104 int has_order_siblings_by;
15106 int j, key_ranges_cnt;
15116 bool parent_tuple_added;
15158 regu_list = regu_list->
next;
15165 key_ranges_cnt = key_info_p->
key_cnt;
15167 for (j = 0; j < key_ranges_cnt; j++)
15182 if (listfile0 ==
NULL)
15189 if (listfile1 ==
NULL)
15196 if (listfile2 ==
NULL)
15201 if (has_order_siblings_by)
15205 if (listfile2_tmp ==
NULL)
15212 if (has_order_siblings_by)
15230 while (listfile1->tuple_cnt > 0)
15233 tuple_rec.
size = 0;
15236 input_tuple_rec.
size = 0;
15261 parent_tuple_added =
false;
15285 father_index[0] = 0;
15295 if (!
DB_IS_NULL (index_valp) && index_valp->need_clear ==
true)
15301 &father_index, &len_father_index) !=
NO_ERROR)
15337 else if (ev_res !=
V_TRUE)
15358 if (!parent_tuple_added)
15362 if (!
DB_IS_NULL (index_valp) && index_valp->need_clear ==
true)
15384 tuple_rec = temp_tuple_rec;
15390 temp_tuple_rec = tuple_rec;
15400 sizeof (parent_pos) * 8);
15402 parent_tuple_added =
true;
15408 if (has_order_siblings_by)
15425 if (!
DB_IS_NULL (index_valp) && index_valp->need_clear ==
true)
15450 if (qp_input_lfscan !=
S_END)
15456 if (has_order_siblings_by)
15461 if (!parent_tuple_added)
15467 if (!
DB_IS_NULL (index_valp) && index_valp->need_clear ==
true)
15484 tuple_rec = temp_tuple_rec;
15490 temp_tuple_rec = tuple_rec;
15517 if (has_order_siblings_by)
15548 if (!
DB_IS_NULL (index_valp) && index_valp->need_clear ==
true)
15604 if (qp_lfscan !=
S_END)
15615 listfile1 = listfile2;
15634 if (has_order_siblings_by)
15642 if (type_list.
domp)
15667 bf2df_str_domain.
type = &bf2df_str_type;
15693 if (temp_tuple_rec.
tpl)
15704 if (has_order_siblings_by)
15715 xasl->status = XASL_SUCCESS;
15724 if (type_list.
domp)
15781 if (temp_tuple_rec.
tpl)
15792 if (has_order_siblings_by)
15801 if (!index_valp && !
DB_IS_NULL (index_valp) && index_valp->need_clear ==
true)
15808 xasl->status = XASL_FAILURE;
15827 bool first_iteration =
true;
15832 if (non_recursive_part ==
NULL)
15843 if (xasl->status == XASL_SUCCESS)
15850 if (non_recursive_part->status == XASL_CLEARED || non_recursive_part->status == XASL_INITIALIZED)
15867 recursive_part->status = XASL_SUCCESS;
15871 bool common_list_optimization =
false;
15872 int recursive_iterations = 0;
15887 if (common_list_optimization ==
true)
15893 if (recursive_iterations++ >= sys_prm_cte_max_recursions)
15896 sys_prm_cte_max_recursions);
15906 if (first_iteration)
15924 if (t_list_id ==
NULL)
15949 first_iteration =
false;
15962 save_recursive_list_id = recursive_part->
list_id;
15965 common_list_optimization =
true;
15979 if (save_recursive_list_id !=
NULL)
15982 recursive_part->
list_id = save_recursive_list_id;
15995 xasl->status = XASL_SUCCESS;
15997 if (recursive_part !=
NULL)
16005 if (save_recursive_list_id !=
NULL)
16008 recursive_part->
list_id = save_recursive_list_id;
16011 if (recursive_part !=
NULL)
16016 xasl->status = XASL_FAILURE;
16037 switch (regu->
type)
16045 i < xasl->val_list->val_cnt && i < connect_by_ptr->proc.connect_by.prior_val_list->val_cnt;
16046 i++, vl = vl->
next, vl_prior = vl_prior->
next)
16094 switch (regu->type)
16098 if (regu->value.arithptr->opcode ==
T_PRIOR)
16142 switch (pred->
type)
16200 switch (tpldescr_status)
16258 pr_type = domain->
type;
16259 if (pr_type ==
NULL)
16306 tuple_rec.
tpl = tpl;
16376 int length1, length2, equal,
i;
16382 regulist = outptr_list->
valptrp;
16389 dbvalp2 = regulist->
value.value.dbvalptr;
16392 domp = type_list->
domp[
i];
16395 pr_type_p = domp->
type;
16413 if (length1 == 0 && length2 == 0)
16417 else if (length1 == 0)
16421 else if (length2 == 0)
16442 regulist = regulist->
next;
16464 char **son_index,
int *len_son_index)
16469 if ((*father_index) ==
NULL)
16474 memset (*father_index, 0, *len_father_index);
16479 if ((*son_index) ==
NULL)
16484 memset (*son_index, 0, *len_son_index);
16501 size_t size, n = father_index ?
strlen (father_index) : 0;
16503 snprintf (counter, 32,
"%d", cnt);
16504 size =
strlen (counter) + n + 2;
16507 if ((*len_son_index > 0) && (size > ((
size_t) (*len_son_index))))
16513 while (size > ((
size_t) (*len_son_index)));
16517 if ((*son_index) ==
NULL)
16522 memset (*son_index, 0, *len_son_index);
16527 strcpy (*son_index, father_index);
16531 (*son_index)[0] = 0;
16535 strcat (*son_index,
".");
16537 strcat (*son_index, counter);
16562 UINT64 old_sort_pages = 0, old_sort_ioreads = 0;
16564 if (orderby_list !=
NULL)
16585 for (n = 0, regu_list = outptr_list->
valptrp; regu_list; regu_list = regu_list->
next)
16601 for (n = 0, i = 0, regu_list = outptr_list->
valptrp; regu_list; regu_list = regu_list->
next, i++)
16624 if (list_id ==
NULL)
16635 xasl->orderby_stats.orderby_filesort =
true;
16640 - old_sort_ioreads);
16677 *parent_pos_valp = regulist->
value.value.dbvalptr;
16686 *level_valp = regulist->
value.value.dbvalptr;
16695 *isleaf_valp = regulist->
value.value.dbvalptr;
16700 *iscycle_valp = regulist->
value.value.dbvalptr;
16705 *index_valp = regulist->
value.value.dbvalptr;
16708 regulist = regulist->
next;
16720 regulist->
value.value.dbvalptr = *parent_pos_valp;
16724 regulist->
value.value.dbvalptr = *level_valp;
16728 regulist->
value.value.dbvalptr = *isleaf_valp;
16732 regulist->
value.value.dbvalptr = *iscycle_valp;
16736 regulist->
value.value.dbvalptr = *index_valp;
16738 regulist = regulist->
next;
16776 DB_VALUE ** index_valp,
char **index_value,
int *index_len)
16787 while ((
int)
strlen ((*index_valp)->data.ch.medium.buf) + 1 > *index_len)
16793 if ((*index_value) ==
NULL)
16799 strcpy (*index_value, (*index_valp)->data.ch.medium.buf);
16820 DB_VALUE level_dbval, parent_pos_dbval;
16825 int level, prev_level,
i;
16832 if (pos_info_p ==
NULL)
16834 goto exit_on_error;
16840 goto exit_on_error;
16844 goto exit_on_error;
16875 goto exit_on_error;
16880 if (level == prev_level)
16886 goto exit_on_error;
16893 sizeof (pos_info_p->
tpl_pos) * 8);
16899 goto exit_on_error;
16903 else if (level > prev_level)
16907 if (prev_scan ==
S_END)
16909 goto exit_on_error;
16912 prev_pos_info_p = pos_info_p;
16914 if (pos_info_p ==
NULL)
16916 pos_info_p = prev_pos_info_p;
16917 goto exit_on_error;
16919 pos_info_p->
stack = prev_pos_info_p;
16924 sizeof (pos_info_p->
tpl_pos) * 8);
16930 goto exit_on_error;
16937 for (i = level; i < prev_level; i++)
16941 prev_pos_info_p = pos_info_p->
stack;
16943 pos_info_p = prev_pos_info_p;
16947 goto exit_on_error;
16951 if (pos_info_p ==
NULL)
16953 goto exit_on_error;
16959 sizeof (pos_info_p->
tpl_pos) * 8);
16965 goto exit_on_error;
16970 prev_level = level;
16975 goto exit_on_error;
16979 goto exit_on_error;
16987 prev_pos_info_p = pos_info_p->
stack;
16989 pos_info_p = prev_pos_info_p;
17001 prev_pos_info_p = pos_info_p->
stack;
17003 pos_info_p = prev_pos_info_p;
17025 goto exit_on_error;
17031 if (t_list_id ==
NULL)
17033 goto exit_on_error;
17038 goto exit_on_error;
17047 if (t_list_id ==
NULL)
17049 goto exit_on_error;
17054 goto exit_on_error;
17060 if (type_list.
domp)
17069 if (type_list.
domp)
17216 goto exit_on_error;
17226 goto exit_on_error;
17236 goto exit_on_error;
17244 goto exit_on_error;
17251 goto exit_on_error;
17261 goto exit_on_error;
17276 goto exit_on_error;
17291 goto exit_on_error;
17322 goto exit_on_error;
17373 while (gby_vallist)
17381 gby_vallist = gby_vallist->
next;
17395 int i, j, nkeys, level = 0;
17417 for (i = 1; i < nkeys; i++)
17530 while (g_outp !=
NULL && d_aggp !=
NULL)
17546 g_outp = g_outp->
next;
17547 d_aggp = d_aggp->
next;
17568 else if (ev_res !=
V_TRUE)
17644 switch (tpldescr_status)
17690 gbstate->
xasl->groupby_stats.rows++;
17807 if (gbstate ==
NULL)
17859 while ((agg = agg->
next))
17896 if (gbstate && gbstate->
g_dim)
17903 next_agg = agg->
next;
17949 valptr_p = valptr_p->
next;
17969 const unsigned char *e0 = s0 + l0;
17970 const unsigned char *e1 = s1 + l1;
17977 while (s0 < e0 && s1 < e1)
17982 while (s0 < e0 && *s0 !=
'.')
17984 if (*s0 >=
'0' && *s0 <=
'9')
17986 b0 = b0 * 10 + (*s0 -
'0');
17992 while (s1 < e1 && *s1 !=
'.')
17994 if (*s1 >=
'0' && *s1 <=
'9')
17996 b1 = b1 * 10 + (*s1 -
'0');
18023 if (s0 == e0 && s1 == e1)
18048 int str_length1, str1_compressed_length = 0, str1_decompressed_length = 0;
18049 int str_length2, str2_compressed_length = 0, str2_decompressed_length = 0;
18052 char *string1 =
NULL, *string2 =
NULL;
18053 bool alloced_string1 =
false, alloced_string2 =
false;
18055 str1 = (
char *) mem1;
18056 str2 = (
char *) mem2;
18065 return bf2df_str_compare ((
unsigned char *) str1, str_length1, (
unsigned char *) str2, str_length2);
18082 if (string1 ==
NULL)
18089 alloced_string1 =
true;
18097 str_length1 = str1_decompressed_length;
18098 string1[str_length1] =
'\0';
18123 if (string2 ==
NULL)
18130 alloced_string2 =
true;
18138 str_length2 = str2_decompressed_length;
18139 string2[str_length2] =
'\0';
18154 c =
bf2df_str_compare ((
unsigned char *) string1, str_length1, (
unsigned char *) string2, str_length2);
18156 if (string1 !=
NULL && alloced_string1 ==
true)
18161 if (string2 !=
NULL && alloced_string2 ==
true)
18169 if (string1 !=
NULL && alloced_string1 ==
true)
18174 if (string2 !=
NULL && alloced_string2 ==
true)
18193 if (string1 ==
NULL || string2 ==
NULL)
18213 int ref_curr_pos = 0;
18219 if (order_list ==
NULL)
18225 for (orderby_ptr = order_list; orderby_ptr !=
NULL; orderby_ptr = orderby_ptr->
next)
18231 regu_list = reference_regu_list;
18232 while (ref_curr_pos > 0 && regu_list)
18234 regu_list = regu_list->
next;
18272 for (group_regu = buildlist->
g_regu_list; group_regu !=
NULL; group_regu = group_regu->
next)
18274 int pos_in_ref_list = 0;
18277 bool val_in_g_val_list_found =
false;
18278 bool g_agg_val_found =
false;
18294 if (pos_in_ref_list < 0)
18299 assert (pos_in_ref_list < reference_out_list->valptr_cnt);
18302 for (ref_regu = reference_regu_list, ref_index = 0; ref_regu !=
NULL && ref_index < pos_in_ref_list;
18303 ref_regu = ref_regu->
next, ref_index++)
18308 assert (ref_index == pos_in_ref_list);
18310 ref_domain = ref_regu->
value.domain;
18319 group_regu->
value.domain = ref_domain;
18322 group_regu->
value.value.pos_descr.dom = ref_domain;
18331 hk_regu->
value.value.pos_descr.dom = ref_domain;
18332 hk_regu->
value.domain = ref_domain;
18341 if (g_val_list->
val == group_regu->
value.vfetch_to)
18343 val_in_g_val_list_found =
true;
18344 val_list_ref_dbvalue = g_val_list->
val;
18351 for (group_agg = buildlist->
g_agg_list; group_agg !=
NULL; group_agg = group_agg->
next)
18364 && operand.value.dbvalptr == val_list_ref_dbvalue)
18367 operand.domain = ref_domain;
18385 group_agg->
domain = ref_domain;
18392 g_agg_val_found =
true;
18399 group_agg->
domain = ref_domain;
18420 g_agg_val_found =
true;
18425 if (!g_agg_val_found)
18433 group_out_regu = group_out_regu->
next)
18442 group_out_regu->
value.domain = ref_domain;
18453 if (agg_p->accumulator_domain.value_dom ==
NULL)
18458 if (agg_p->accumulator_domain.value2_dom ==
NULL)
18472 for (i = 0; i < buildlist->
g_hkey_size && group_regu !=
NULL; i++, group_regu = group_regu->
next)
18527 HL_HEAPID save_heapid = 0;
18530 if (regu_list !=
NULL)
18542 for (; agg_p !=
NULL; agg_p = agg_p->
next)
18573 dbval = &benchmark_dummy_dbval;
18589 || agg_p->accumulator_domain.value2_dom ==
NULL)
18620 && (agg_p->accumulator_domain.value_dom ==
NULL || agg_p->accumulator_domain.value2_dom ==
NULL))
18629 agg_p->accumulator_domain.value_dom = agg_p->
domain;
18639 agg_p->accumulator_domain.value_dom =
18645 agg_p->accumulator_domain.value_dom =
18651 agg_p->accumulator_domain.value_dom =
18662 agg_p->accumulator_domain.value_dom = agg_p->
domain;
18683 agg_p->accumulator_domain.value_dom = agg_p->
domain;
18721 status =
tp_value_cast (dbval, dbval, tmp_domain_p,
false);
18727 status =
tp_value_cast (dbval, dbval, tmp_domain_p,
false);
18735 status =
tp_value_cast (dbval, dbval, tmp_domain_p,
false);
18738 if (save_heapid != 0)
18755 "DOUBLE, DATETIME or TIME");
18761 agg_p->
domain = tmp_domain_p;
18762 agg_p->accumulator_domain.value_dom = tmp_domain_p;
18815 int result = 0, ls_flag = 0;
18817 int i, ncolumns = 0;
18819 bool all_cols_equal =
false;
18839 xasl->groupby_stats.run_groupby =
true;
18840 xasl->groupby_stats.groupby_sort =
false;
18841 xasl->groupby_stats.groupby_hash =
HS_NONE;
18842 xasl->groupby_stats.rows = 0;
18881 if (output_type_list.
domp)
18886 if (output_list_id ==
NULL)
18929 if (list_dbvals ==
NULL)
18947 all_cols_equal =
true;
18950 for (i = 0; i < ncolumns; i++)
18952 if (regu_list ==
NULL)
18955 goto exit_on_error;
18961 goto exit_on_error;
18981 all_cols_equal =
false;
18994 regu_list = regu_list->
next;
19002 else if (all_cols_equal)
19056 for (i = 0; i < ncolumns; i++)
19090 int i = 0,
count = 0,
index = 0, att_id, sort_index_pos;
19109 multi_range_opt = &spec->s_id.
s.isid.multi_range_opt;
19112 while (orderby_list)
19115 orderby_list = orderby_list->
next;
19120 if (sort_col_out_val_ref ==
NULL)
19125 for (orderby_list = xasl->
orderby_list; orderby_list !=
NULL; orderby_list = orderby_list->
next)
19139 sort_col_out_val_ref[
index++] = regu_list->
value.value.dbvalptr;
19150 goto exit_on_error;
19160 goto exit_on_error;
19166 goto exit_on_error;
19175 for (
index = 0, orderby_list = xasl->
orderby_list; index < count; index++, orderby_list = orderby_list->next)
19180 sort_index_pos = -1;
19182 for (regu_list = spec->s_id.
s.isid.rest_regu_list; regu_list !=
NULL; regu_list = regu_list->
next)
19186 att_id = regu_list->
value.value.attr_descr.id;
19193 for (i = 0; i < spec->s_id.
s.isid.bt_num_attrs; i++)
19195 if (att_id == spec->s_id.
s.isid.bt_attr_ids[i])
19197 sort_index_pos =
i;
19202 if (sort_index_pos == -1)
19205 multi_range_opt->
use =
false;
19220 if (sort_col_out_val_ref)
19247 for (spec_list = xasl->
spec_list; spec_list !=
NULL; spec_list = spec_list->
next)
19254 if (spec_list->s_id.
s.isid.multi_range_opt.use)
19282 int estimated_pages;
19283 bool finalized =
false;
19325 if (interm_type_list.
domp)
19330 if (interm_list_id ==
NULL)
19357 if (output_type_list.
domp)
19362 if (output_list_id ==
NULL)
19432 for (i = 0; i < analytic_state.
func_count; i++)
19487 for (i = 0; i < analytic_state.
func_count; i++)
19517 func_state->
func_p = func_p;
19639 bool has_interpolation_func =
false;
19642 int interpolation_func_sort_prefix_len = 0;
19655 analytic_state->
xasl = xasl;
19690 for (analytic_state->
func_count = 0, func_p = a_func_list; func_p !=
NULL;
19705 for (i = 0, func_p = a_func_list; i < analytic_state->
func_count; i++, func_p = func_p->
next)
19715 for (func_p = a_func_list; func_p !=
NULL; func_p = func_p->next)
19719 has_interpolation_func =
true;
19721 if (interpolation_func_sort_prefix_len == 0)
19723 interpolation_func_sort_prefix_len = func_p->sort_prefix_size;
19727 assert (interpolation_func_sort_prefix_len == func_p->sort_prefix_size);
19733 if (has_interpolation_func)
19746 for (regu_list = a_regu_list; regu_list; regu_list = regu_list->
next)
19753 int pos = regu_list->
value.value.pos_descr.pos_no;
19754 if (pos <= type_list->type_cnt)
19756 regu_list->
value.value.pos_descr.dom = type_list->
domp[pos];
19757 regu_list->
value.domain = type_list->
domp[pos];
19762 return analytic_state;
19811 goto exit_on_error;
19819 goto exit_on_error;
19840 goto exit_on_error;
19872 goto exit_on_error;
19888 for (i = 0; i < analytic_state->
func_count; i++)
19896 for (i = 0; i < analytic_state->
func_count; i++)
19899 bool is_same_group =
false;
19917 is_same_group =
true;
19928 if (!is_same_group)
19933 is_same_group =
true;
19942 is_same_group =
true;
19948 if (!is_same_group)
19953 goto exit_on_error;
19964 goto exit_on_error;
19979 return analytic_state->
state;
20002 int instnum_flag,
i;
20018 for (i = 0; i < analytic_state->
func_count; i++)
20030 if (instnum_flag & XASL_INSTNUM_FLAG_EVAL_DEFER)
20037 if (stage != instnum_stage)
20051 if (is_output_rec ==
V_ERROR)
20073 const RECDES * key,
bool reinit)
20146 bool is_same_group)
20174 if (!is_same_group)
20238 for (i = 0; i < analytic_state->
func_count; i++)
20314 for (i = 0; i < analytic_state->
func_count; i++)
20390 if (recs_in_bucket == 0)
20395 else if (compensate == 0)
20402 int xcount = (recs_in_bucket + 1) * compensate;
20447 int group_tuple_count;
20450 double nth_idx = 0.0;
20452 bool put_default =
false;
20454 if (func_state ==
NULL)
20461 func_p = func_state->
func_p;
20484 while (regu_idx > 0 && regulist !=
NULL)
20486 regulist = regulist->
next;
20489 if (regulist ==
NULL)
20515 target_idx = offset_val.
data.
i;
20554 sprintf (buf,
"%.15g", nth_idx);
20559 target_idx = (int) floor (nth_idx);
20562 if (target_idx >= 0 && target_idx < group_tuple_count)
20566 target_idx = group_tuple_count - target_idx;
20587 while (regu_idx > 0 && regulist !=
NULL)
20589 regulist = regulist->
next;
20592 if (regulist ==
NULL)
20597 default_val_p = regulist->
value.vfetch_to;
20600 if (target_idx >= 0 && target_idx < group_tuple_count)
20613 put_default =
true;
20619 put_default =
true;
20700 double f_row_num_d, c_row_num_d, row_num_d, percentile_d;
20705 func_p = func_state->
func_p;
20730 percentile_d = 0.5;
20755 f_row_num_d = floor (row_num_d);
20759 c_row_num_d = f_row_num_d;
20763 c_row_num_d = ceil (row_num_d);
20767 if (f_row_num_d == c_row_num_d)
20932 int max_group_changes,
bool ignore_nulls)
20941 if (max_group_changes <= 0 && func_state->group_tuple_position >= func_state->
curr_group_tuple_count - 1)
20952 if (max_group_changes <= 0 && func_state->group_tuple_position <= 0)
21015 max_group_changes--;
21035 max_group_changes--;
21105 int offset = position;
21167 for (i = 0; i < analytic_state->
func_count; i++)
21201 for (i = 0; i < analytic_state->
func_count; i++)
21209 swap = func_p->
value;
21214 for (regu_list_p = analytic_state->
a_regu_list; regu_list_p !=
NULL; regu_list_p = regu_list_p->
next)
21216 if (regu_list_p->
value.vfetch_to == func_p->
value)
21226 tplrec_scan.
size = 0;
21228 tplrec_write.
size = 0;
21261 for (i = 0; i < analytic_state->
func_count; i++)
21314 ignore_nulls =
false;
21385 &xasl_state->
vd, &tplrec_write);
21395 for (i = 0; i < analytic_state->
func_count; i++)
21403 swap = func_p->
value;
21408 for (regu_list_p = analytic_state->
a_regu_list; regu_list_p !=
NULL; regu_list_p = regu_list_p->
next)
21410 if (regu_list_p->
value.vfetch_to == func_p->
value)
21419 if (tplrec_write.
tpl !=
NULL)
21422 tplrec_write.
size = 0;
21427 for (i = 0; i < analytic_state->
func_count; i++)
21451 memset (&xasl_node, 0,
sizeof (
XASL_NODE));
21453 if (dealloc_dbvalues)
21476 memset (&xasl_node, 0,
sizeof (
XASL_NODE));
21494 memset (&xasl_node, 0,
sizeof (
XASL_NODE));
21518 for (scan = scan_list; scan !=
NULL; scan = scan->
scan_ptr)
21565 bool found =
false;
21568 for (aptr = aptr_list; aptr !=
NULL; aptr = aptr->
scan_ptr)
21578 for (i = 0; i < query_classes_count; i++)
21580 query_class = &query_classes[
i];
21585 class_oid = &query_class->
class_oid[j];
21610 for (i = 0; i < query_classes_count && !found; i++)
21612 query_class = &query_classes[
i];
21654 int idx_incache = -1;
21660 char *attr_name =
NULL, *
string =
NULL;
21664 char **attr_names =
NULL;
21665 int *attr_ids =
NULL;
21666 int function_asc_desc;
21668 bool scancache_inited =
false;
21671 char *class_name =
NULL;
21678 int function_index_pos = -1;
21679 int index_position = 0, size_values = 0;
21680 int num_idx_att = 0;
21681 char *comment =
NULL;
21682 int alloced_string = 0;
21683 HL_HEAPID save_heapid = 0;
21711 catalog_access_info.
class_oid = class_oid;
21712 catalog_access_info.
dir_oid = &dir_oid;
21728 if (disk_repr_p ==
NULL)
21739 scancache_inited =
true;
21746 rep =
heap_classrepr_get (thread_p, class_oid, &class_record, class_repr_id, &idx_incache);
21753 assert (size_values == 14);
21755 if (out_values ==
NULL)
21764 out_values[
i] = &(regu_var_p->
value.value.dbval);
21768 attr_names = (
char **) malloc (rep->
n_attributes * sizeof (
char *));
21769 if (attr_names ==
NULL)
21774 attr_ids = (
int *) malloc (rep->
n_attributes * sizeof (
int));
21775 if (attr_ids ==
NULL)
21782 attr_names[
i] =
NULL;
21786 for (i = 0, attrepr = rep->
attributes; i < rep->n_attributes; i++, attrepr++)
21789 alloced_string = 0;
21791 error =
or_get_attrname (&class_record, attrepr->
id, &
string, &alloced_string);
21798 attr_name = string;
21799 if (attr_name ==
NULL)
21804 attr_names[
i] =
strdup (attr_name);
21805 attr_ids[
i] = attrepr->
id;
21807 if (
string !=
NULL && alloced_string == 1)
21845 function_index_pos = -1;
21846 num_idx_att = index->
n_atts;
21857 index_position = 0;
21858 for (j = 0; j < num_idx_att; j++)
21860 index_att = index->
atts[j];
21861 att_id = index_att->
id;
21864 if (index_position == function_index_pos)
21890 if (cardinality < 0)
21922 if (att_id == attr_ids[k])
21938 if (function_index_pos >= 0)
21949 if (function_asc_desc)
21959 db_make_int (out_values[3], function_index_pos + 1);
21968 if (cardinality < 0)
21988 if (comment !=
NULL)
21994 for (j = 0; j < size_values; j++)
22002 if (attr_names[i] !=
NULL)
22018 scancache_inited =
false;
22043 if (save_heapid != 0)
22055 for (i = 0; i < size_values; i++)
22070 if (attr_names[i] !=
NULL)
22088 if (scancache_inited)
22091 scancache_inited =
false;
22094 #if defined(SERVER_MODE) 22109 if (save_heapid != 0)
22115 xasl->status = XASL_FAILURE;
22128 static const char *
22158 return "TIMESTAMP";
22161 return "TIMESTAMPTZ";
22164 return "TIMESTAMPLTZ";
22170 return "DATETIMETZ";
22173 return "DATETIMELTZ";
22202 return "NCHAR VARYING";
22208 return "BIT VARYING";
22221 return "UNKNOWN DATA_TYPE";
22234 const char *name =
NULL;
22235 int precision = -1;
22238 int enum_elements_count = 0;
22240 const char *set_of_string =
NULL;
22250 scale = domain->
scale;
22264 if (setdomain ==
NULL)
22268 set_of_string =
"SET OF ";
22272 if (setdomain ==
NULL)
22276 set_of_string =
"MULTISET OF ";
22280 if (setdomain ==
NULL)
22284 set_of_string =
"SEQUENCE OF ";
22302 DB_VALUE enum_arg1, enum_arg2, enum_result, *penum_arg1, *penum_arg2, *penum_result, *penum_temp;
22304 DB_VALUE quote, quote_comma_space, enum_;
22308 assert (enum_elements_count >= 0);
22310 penum_arg1 = &enum_arg1;
22311 penum_arg2 = &enum_arg2;
22312 penum_result = &enum_result;
22320 for (i = 0; i < enum_elements_count; i++)
22322 penum_temp = penum_arg1;
22323 penum_arg1 = penum_result;
22324 penum_result = penum_temp;
22329 goto exit_on_error;
22333 penum_temp = penum_arg1;
22334 penum_arg1 = penum_result;
22335 penum_result = penum_temp;
22337 db_make_string (penum_arg2, enum_elements[i].str_val.medium.buf);
22343 goto exit_on_error;
22347 penum_temp = penum_arg1;
22348 penum_arg1 = penum_result;
22349 penum_result = penum_temp;
22350 if (i < enum_elements_count - 1)
22357 goto exit_on_error;
22367 goto exit_on_error;
22374 penum_temp = penum_arg1;
22375 penum_arg1 = penum_result;
22376 penum_result = penum_temp;
22380 goto exit_on_error;
22388 else if (setdomain !=
NULL)
22391 DB_VALUE set_arg1, set_arg2, set_result, *pset_arg1, *pset_arg2, *pset_result, *pset_temp;
22394 char **ordered_names =
NULL, *
min, *temp;
22395 int count_names = 0,
i, j, idx_min;
22397 for (setdomain = domain->
setdomain; setdomain; setdomain = setdomain->
next)
22402 ordered_names = (
char **) malloc (count_names *
sizeof (
char *));
22403 if (ordered_names ==
NULL)
22408 for (setdomain = domain->
setdomain,
i = 0; setdomain; setdomain = setdomain->
next,
i++)
22413 for (
i = 0;
i < count_names - 1;
i++)
22416 min = ordered_names[
i];
22417 for (j =
i + 1; j < count_names; j++)
22419 if (strcmp (ordered_names[
i], ordered_names[j]) > 0)
22421 min = ordered_names[j];
22428 temp = ordered_names[
i];
22429 ordered_names[
i] = ordered_names[idx_min];
22430 ordered_names[idx_min] = temp;
22434 pset_arg1 = &set_arg1;
22435 pset_arg2 = &set_arg2;
22436 pset_result = &set_result;
22441 for (setdomain = domain->
setdomain,
i = 0; setdomain; setdomain = setdomain->
next,
i++)
22443 pset_temp = pset_arg1;
22444 pset_arg1 = pset_result;
22445 pset_result = pset_temp;
22453 goto exit_on_error;
22460 pset_temp = pset_arg1;
22461 pset_arg1 = pset_result;
22462 pset_result = pset_temp;
22468 goto exit_on_error;
22479 else if (precision >= 0)
22481 DB_VALUE db_int_scale, db_str_scale;
22482 DB_VALUE db_int_precision, db_str_precision;
22483 DB_VALUE prec_scale_result, prec_scale_arg1, *pprec_scale_arg1, *pprec_scale_result, *pprec_scale_temp;
22484 DB_VALUE comma, bracket1, bracket2;
22491 goto exit_on_error;
22493 pprec_scale_arg1 = &prec_scale_arg1;
22494 pprec_scale_result = &prec_scale_result;
22504 goto exit_on_error;
22508 pprec_scale_temp = pprec_scale_arg1;
22509 pprec_scale_arg1 = pprec_scale_result;
22510 pprec_scale_result = pprec_scale_temp;
22515 goto exit_on_error;
22527 goto exit_on_error;
22530 pprec_scale_temp = pprec_scale_arg1;
22531 pprec_scale_arg1 = pprec_scale_result;
22532 pprec_scale_result = pprec_scale_temp;
22537 goto exit_on_error;
22541 pprec_scale_temp = pprec_scale_arg1;
22542 pprec_scale_arg1 = pprec_scale_result;
22543 pprec_scale_result = pprec_scale_temp;
22548 goto exit_on_error;
22554 pprec_scale_temp = pprec_scale_arg1;
22555 pprec_scale_arg1 = pprec_scale_result;
22556 pprec_scale_result = pprec_scale_temp;
22561 goto exit_on_error;
22570 else if (validator !=
NULL)
22573 DB_VALUE bracket1, bracket2, schema;
22598 goto exit_on_error;
22623 int idx_incache = -1;
22626 char *attr_name =
NULL, *default_value_string =
NULL;
22627 const char *default_expr_type_string =
NULL, *default_expr_format =
NULL;
22628 char *attr_comment =
NULL;
22633 bool scancache_inited =
false;
22636 volatile int idx_val;
22638 int i, j, k, idx_all_attr, size_values, found_index_type = -1;
22639 bool search_index_type =
true;
22641 int index_type_priorities[] = { 1, 0, 1, 0, 2, 0 };
22642 int index_type_max_priority = 2;
22643 DB_VALUE def_order, attr_class_type;
22645 int all_class_attr_lengths[3];
22646 bool full_columns =
false;
22647 char *
string =
NULL;
22648 int alloced_string = 0;
22649 HL_HEAPID save_heapid = 0;
22651 if (xasl ==
NULL || xasl_state ==
NULL)
22671 scancache_inited =
true;
22689 if (out_values ==
NULL)
22696 out_values[
i] = &(regu_var_p->
value.value.dbval);
22709 full_columns =
true;
22712 for (idx_all_attr = 0; idx_all_attr < 3; idx_all_attr++)
22722 for (i = 0, attrepr = all_class_attr[idx_all_attr]; i < all_class_attr_lengths[idx_all_attr]; i++, attrepr++)
22735 alloced_string = 0;
22737 error =
or_get_attrname (&class_record, attrepr->
id, &
string, &alloced_string);
22744 attr_name = string;
22746 if (
string !=
NULL && alloced_string == 1)
22758 switch (attrepr->
type)
22785 found_index_type = -1;
22786 search_index_type =
true;
22787 for (j = 0; j < attrepr->
n_btids && search_index_type; j++)
22789 btid = attrepr->
btids + j;
22796 if (found_index_type == -1
22797 || index_type_priorities[index->
type] > index_type_priorities[found_index_type])
22799 found_index_type = index->
type;
22800 if (index_type_priorities[found_index_type] == index_type_max_priority)
22803 search_index_type =
false;
22811 switch (found_index_type)
22835 alloced_string = 0;
22838 const char *default_expr_op_string =
NULL;
22840 default_expr_type_string =
22850 len = ((default_expr_op_string ?
strlen (default_expr_op_string) : 0)
22851 + 6 + strlen (default_expr_type_string)
22852 + (default_expr_format ?
strlen (default_expr_format) : 0));
22854 default_value_string = (
char *) malloc (len + 1);
22855 if (default_value_string ==
NULL)
22860 strcpy (default_value_string, default_expr_op_string);
22861 strcat (default_value_string,
"(");
22862 strcat (default_value_string, default_expr_type_string);
22863 if (default_expr_format)
22865 strcat (default_value_string,
", \'");
22866 strcat (default_value_string, default_expr_format);
22867 strcat (default_value_string,
"\'");
22870 strcat (default_value_string,
")");
22877 if (default_expr_type_string)
22916 size_t len =
strlen (saved);
22919 if (default_expr_op_string ==
NULL)
22925 const char *on_update_string =
"ON UPDATE ";
22926 size_t str_len = len +
strlen (on_update_string) +
strlen (default_expr_op_string) + 1;
22933 if (str_val ==
NULL)
22938 strcpy (str_val, saved);
22941 strcat (str_val,
" ");
22943 strcat (str_val, on_update_string);
22944 strcat (str_val, default_expr_op_string);
22946 if (default_expr_op_string)
22958 int alloced_string = 0;
22959 char *
string =
NULL;
22968 attr_comment = string;
22970 if (
string !=
NULL && alloced_string == 1)
22979 for (j = 1; j < size_values; j++)
22994 scancache_inited =
false;
23006 if (save_heapid != 0)
23018 for (i = 0; i < size_values; i++)
23031 if (scancache_inited)
23036 #if defined(SERVER_MODE) 23051 if (save_heapid != 0)
23057 xasl->status = XASL_FAILURE;
23082 if (internal_classes ==
NULL)
23087 *internal_classes =
NULL;
23091 if (classes ==
NULL)
23097 for (i = 0; i <
count; i++)
23099 query_class = query_classes +
i;
23100 class_ = &(classes[
i]);
23131 goto exit_on_error;
23136 *internal_classes = classes;
23170 int idx, new_assign_idx,
count;
23177 if (mvcc_reev_assigns ==
NULL || !num_assignments)
23186 for (idx = 0, regu_var = outptr_list->
valptrp; idx < count; idx++, regu_var = regu_var->next->
next)
23191 regu_var = regu_var->
next;
23196 if (new_assigns ==
NULL)
23201 for (idx = 0, new_assign_idx = 0; idx < num_assignments; idx++)
23203 assign = &assignments[idx];
23204 claz = &classes[assign->
cls_idx];
23206 new_assign = &new_assigns[new_assign_idx++];
23208 if (new_assign->constant ==
NULL)
23210 new_assign->regu_right = ®u_var->
value;
23211 regu_var = regu_var->
next;
23215 new_assign->regu_right =
NULL;
23217 new_assign->next =
NULL;
23225 while (prev_new_assign->next !=
NULL)
23227 prev_new_assign = prev_new_assign->
next;
23229 prev_new_assign->
next = new_assign;
23233 *mvcc_reev_assigns = new_assigns;
23251 for (i = 0; i <
count; i++)
23253 cls_int = &classes[
i];
23292 while (aptr_list !=
NULL && curr_spec ==
NULL)
23297 curr_spec = curr_spec->
next;
23302 if (curr_spec ==
NULL)
23307 mvcc_reev_class->
init (curr_spec->s_id);
23308 mvcc_reev_class->
cls_oid = *class_oid;
23406 internal_class->
class_hfid, op_type,
false);
23407 if (pcache ==
NULL)
23455 int savepoint_used = 0;
23464 savepoint_used = 1;
23526 if (savepoint_used)
23548 int agg_count = 0, part_count = 0,
i;
23553 PARTITION_SPEC_TYPE *part =
NULL;
23556 agg = aggregate_list;
23569 if (agg_count == 0)
23572 *helpers_countp = 0;
23579 if (helpers ==
NULL)
23587 for (
i = 0;
i < agg_count;
i++)
23594 for (part_count = 0, part = spec->parts; part !=
NULL; part_count++, part = part->next);
23595 if (part_count == 0)
23607 agg = aggregate_list;
23609 while (agg !=
NULL)
23626 *helpersp = helpers;
23627 *helpers_countp = agg_count;
23631 if (helpers !=
NULL)
23633 for (
i = 0;
i < agg_count;
i++)
23635 if (helpers[
i].btids !=
NULL)
23639 if (helpers[
i].hfids !=
NULL)
23650 *helpers_countp = 0;
23666 bool * is_scan_needed)
23669 int i = 0, helpers_count = 0;
23676 *is_scan_needed =
true;
23680 for (agg_ptr = agg_list; agg_ptr; agg_ptr = agg_ptr->
next)
23698 *is_scan_needed =
true;
23705 if (helpers !=
NULL)
23707 for (i = 0; i < helpers_count; i++)
23709 if (helpers[i].btids !=
NULL)
23713 if (helpers[i].hfids !=
NULL)
23733 bool * is_scan_needed)
23741 for (agg_ptr = agg_list; agg_ptr; agg_ptr = agg_ptr->
next)
23746 *is_scan_needed =
true;
23754 *is_scan_needed =
true;
23765 if (class_cos ==
NULL)
23768 *is_scan_needed =
true;
23776 *is_scan_needed =
true;
23785 *is_scan_needed =
true;
23809 *is_scan_needed =
true;
23814 for (agg_ptr = agg_list; agg_ptr; agg_ptr = agg_ptr->
next)
23827 *is_scan_needed =
true;
23848 TOPN_TUPLES *top_n =
NULL;
23850 UINT64 estimated_size = 0, max_size = 0;
23915 estimated_size = 0;
23933 var_list = var_list->
next;
23944 var_list = var_list->
next;
23954 estimated_size *= ubound;
23956 if (estimated_size > max_size)
23964 top_n = (TOPN_TUPLES *)
db_private_alloc (thread_p,
sizeof (TOPN_TUPLES));
23971 top_n->max_size = max_size;
23972 top_n->total_size = 0;
23974 top_n->tuples = (TOPN_TUPLE *)
db_private_alloc (thread_p, ubound *
sizeof (TOPN_TUPLE));
23975 if (top_n->tuples ==
NULL)
23980 memset (top_n->tuples, 0, ubound * sizeof (TOPN_TUPLE));
23989 top_n->heap = heap;
23991 top_n->values_count =
count;
23993 xasl->topn_items = top_n;
24004 if (top_n->tuples !=
NULL)
24026 TOPN_TUPLES *proc = (TOPN_TUPLES *) arg;
24027 TOPN_TUPLE *left_tuple = *((TOPN_TUPLE **) left);
24028 TOPN_TUPLE *right_tuple = *((TOPN_TUPLE **) right);
24031 for (key = proc->sort_items; key !=
NULL; key = key->
next)
24034 cmp =
qexec_topn_cmpval (&left_tuple->values[pos], &right_tuple->values[pos], key);
24135 TOPN_TUPLE *heap_max =
NULL;
24142 TOPN_TUPLE *tpl =
NULL;
24143 int idx = topn_items->heap->element_count;
24145 if (topn_items->total_size + tpldescr->
tpl_size > topn_items->max_size)
24151 tpl = &topn_items->tuples[idx];
24162 tpl->values_size = tpldescr->
tpl_size;
24163 topn_items->total_size += tpldescr->
tpl_size;
24165 (void)
bh_insert (topn_items->heap, &tpl);
24178 for (key = topn_items->sort_items; key !=
NULL; key = key->
next)
24199 if (topn_items->total_size - heap_max->values_size + tpldescr->
tpl_size > topn_items->max_size)
24206 topn_items->total_size -= heap_max->values_size;
24215 heap_max->values_size = tpldescr->
tpl_size;
24216 topn_items->total_size += tpldescr->
tpl_size;
24234 TOPN_TUPLES *topn =
NULL;
24237 TOPN_TUPLE *tuple =
NULL;
24251 topn = xasl->topn_items;
24254 values_count = topn->values_count;
24255 xasl->orderby_stats.orderby_topnsort =
true;
24280 for (
i = 0;
i < values_count;
i++)
24313 tpl_descr->
f_cnt = 0;
24332 error = value_size;
24336 tpl_descr->
tpl_size += value_size;
24337 tpl_descr->
f_cnt++;
24371 if (xasl->topn_items !=
NULL)
24373 if (xasl->topn_items->tuples !=
NULL)
24378 xasl->topn_items =
NULL;
24410 if (tuple->values !=
NULL)
24412 for (i = 0; i <
count; i++)
24418 tuple->values_size = 0;
24585 for (agg_p = agg_list; agg_p; agg_p = agg_p->
next)
24588 && agg_p->
info.dist_percent.const_array !=
NULL)
24591 agg_p->
info.dist_percent.list_len = 0;
24621 for (list_node = list; list_node; list_node = list_node->
next)
24629 #if defined(SERVER_MODE) 24639 char *trace_str =
NULL;
24648 qdump_print_stats_text (fp, xasl, 0);
24654 trace = json_object ();
24655 qdump_print_stats_json (xasl, trace);
24656 trace_str = json_dumps (trace, JSON_INDENT (2) | JSON_PRESERVE_ORDER);
24658 json_object_clear (trace);
24659 json_decref (trace);
24662 if (trace_str !=
NULL)
24684 switch (pred->
type)
24735 int value_count = 0,
i = 0, error_code =
NO_ERROR;
24744 proc->agg_hash_context->key_domains =
NULL;
24745 proc->agg_hash_context->accumulator_domains =
NULL;
24746 proc->agg_hash_context->temp_dbval_array =
NULL;
24747 proc->agg_hash_context->part_list_id =
NULL;
24748 proc->agg_hash_context->sorted_part_list_id =
NULL;
24749 proc->agg_hash_context->hash_table =
NULL;
24750 proc->agg_hash_context->temp_key =
NULL;
24751 proc->agg_hash_context->temp_part_key =
NULL;
24752 proc->agg_hash_context->curr_part_key =
NULL;
24753 proc->agg_hash_context->temp_part_value =
NULL;
24754 proc->agg_hash_context->curr_part_value =
NULL;
24755 proc->agg_hash_context->sort_key.key =
NULL;
24756 proc->agg_hash_context->sort_key.nkeys = 0;
24763 proc->agg_hash_context->temp_dbval_array =
24765 if (proc->agg_hash_context->temp_dbval_array ==
NULL)
24769 goto exit_on_error;
24776 proc->agg_hash_context->key_domains =
24778 if (proc->agg_hash_context->key_domains ==
NULL)
24781 goto exit_on_error;
24788 proc->agg_hash_context->key_domains[
i] = regu_list->value.domain;
24796 proc->agg_hash_context->accumulator_domains =
24798 sizeof (AGGREGATE_ACCUMULATOR_DOMAIN *) *
24800 if (proc->agg_hash_context->accumulator_domains ==
NULL)
24803 sizeof (AGGREGATE_ACCUMULATOR_DOMAIN *) * proc->
g_func_count);
24804 goto exit_on_error;
24811 proc->agg_hash_context->accumulator_domains[
i] = &agg_list->accumulator_domain;
24825 goto exit_on_error;
24833 type_list.
domp[value_count++] = regu_list->value.domain;
24834 regu_list = regu_list->
next;
24852 proc->agg_hash_context->sort_key.key =
NULL;
24853 proc->agg_hash_context->sort_key.nkeys = 0;
24860 proc->agg_hash_context->part_list_id->tpl_descr.f_cnt = type_list.
type_cnt;
24861 proc->agg_hash_context->part_list_id->tpl_descr.f_valp =
24863 if (proc->agg_hash_context->part_list_id->tpl_descr.f_valp ==
NULL)
24866 goto exit_on_error;
24868 proc->agg_hash_context->part_list_id->tpl_descr.clear_f_val_at_clone_decache =
24869 (
bool *) malloc (
sizeof (
bool) * type_list.
type_cnt);
24870 if (proc->agg_hash_context->part_list_id->tpl_descr.clear_f_val_at_clone_decache ==
NULL)
24873 goto exit_on_error;
24877 proc->agg_hash_context->part_list_id->tpl_descr.clear_f_val_at_clone_decache[
i] =
false;
24880 proc->agg_hash_context->sorted_part_list_id->tpl_descr.f_cnt = type_list.
type_cnt;
24881 proc->agg_hash_context->sorted_part_list_id->tpl_descr.f_valp =
24883 if (proc->agg_hash_context->sorted_part_list_id->tpl_descr.f_valp ==
NULL)
24886 goto exit_on_error;
24888 proc->agg_hash_context->sorted_part_list_id->tpl_descr.clear_f_val_at_clone_decache =
24889 (
bool *) malloc (
sizeof (
bool) * type_list.
type_cnt);
24890 if (proc->agg_hash_context->sorted_part_list_id->tpl_descr.clear_f_val_at_clone_decache ==
NULL)
24893 goto exit_on_error;
24897 proc->agg_hash_context->sorted_part_list_id->tpl_descr.clear_f_val_at_clone_decache[
i] =
false;
24901 proc->agg_hash_context->part_scan_id.status =
S_CLOSED;
24909 proc->agg_hash_context->hash_table =
24911 if (proc->agg_hash_context->hash_table ==
NULL)
24913 goto exit_on_error;
24918 proc->agg_hash_context->hash_table->build_lru_list =
true;
24928 if (proc->agg_hash_context->temp_key ==
NULL || proc->agg_hash_context->temp_part_key ==
NULL 24929 || proc->agg_hash_context->curr_part_key ==
NULL)
24931 goto exit_on_error;
24940 if (proc->agg_hash_context->temp_part_value ==
NULL || proc->agg_hash_context->curr_part_value ==
NULL)
24942 goto exit_on_error;
24948 proc->agg_hash_context->tuple_recdes.data = 0;
24949 proc->agg_hash_context->tuple_recdes.type = 0;
24950 proc->agg_hash_context->tuple_recdes.length = 0;
24951 proc->agg_hash_context->tuple_recdes.area_size = 0;
24956 proc->agg_hash_context->input_tuple.size = 0;
24957 proc->agg_hash_context->input_tuple.tpl =
NULL;
24962 proc->agg_hash_context->hash_size = 0;
24963 proc->agg_hash_context->group_count = 0;
24964 proc->agg_hash_context->tuple_count = 0;
24965 proc->agg_hash_context->sorted_count = 0;
24994 if (
p->value.vfetch_to !=
NULL)
25001 if (proc->agg_hash_context->temp_dbval_array !=
NULL)
25003 db_private_free (thread_p, proc->agg_hash_context->temp_dbval_array);
25004 proc->agg_hash_context->temp_dbval_array =
NULL;
25008 if (proc->agg_hash_context->accumulator_domains !=
NULL)
25010 db_private_free (thread_p, proc->agg_hash_context->accumulator_domains);
25011 proc->agg_hash_context->accumulator_domains =
NULL;
25014 if (proc->agg_hash_context->key_domains !=
NULL)
25017 proc->agg_hash_context->key_domains =
NULL;
25024 if (proc->agg_hash_context->hash_table !=
NULL)
25027 mht_destroy (proc->agg_hash_context->hash_table);
25029 proc->agg_hash_context->hash_table =
NULL;
25036 if (proc->agg_hash_context->part_list_id !=
NULL)
25041 proc->agg_hash_context->part_list_id =
NULL;
25044 if (proc->agg_hash_context->sorted_part_list_id !=
NULL)
25049 proc->agg_hash_context->sorted_part_list_id =
NULL;
25053 if (proc->agg_hash_context->temp_key !=
NULL)
25056 proc->agg_hash_context->temp_key =
NULL;
25059 if (proc->agg_hash_context->temp_part_key !=
NULL)
25062 proc->agg_hash_context->temp_part_key =
NULL;
25065 if (proc->agg_hash_context->curr_part_key !=
NULL)
25068 proc->agg_hash_context->curr_part_key =
NULL;
25071 if (proc->agg_hash_context->temp_part_value !=
NULL)
25074 proc->agg_hash_context->temp_part_value =
NULL;
25077 if (proc->agg_hash_context->curr_part_value !=
NULL)
25080 proc->agg_hash_context->curr_part_value =
NULL;
25084 if (proc->agg_hash_context->tuple_recdes.data !=
NULL)
25086 db_private_free (thread_p, proc->agg_hash_context->tuple_recdes.data);
25087 proc->agg_hash_context->tuple_recdes.data =
NULL;
25088 proc->agg_hash_context->tuple_recdes.area_size = 0;
25092 proc->agg_hash_context->hash_size = 0;
25093 proc->agg_hash_context->group_count = 0;
25094 proc->agg_hash_context->tuple_count = 0;
25117 while (regu_list !=
NULL)
25127 regu_list = regu_list->
next;
25159 if (diff_pos >= 0 && result !=
DB_EQ)
25163 if (result ==
DB_GT)
25167 else if (result ==
DB_LT)
25180 else if (result ==
DB_EQ)
25186 else if (result ==
DB_GT)
#define QFILE_TUPLE_VALUE_HEADER_SIZE
QPROC_QUALIFICATION qualification
static int qexec_execute_insert(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, bool skip_aptr)
QPROC_SINGLE_FETCH single_fetch
AGGREGATE_HASH_CONTEXT * agg_hash_context
TP_DOMAIN tp_String_domain
int qfile_reallocate_tuple(QFILE_TUPLE_RECORD *tuple_record_p, int tuple_size)
regu_variable_node * key1
static QFILE_LIST_ID * qexec_merge_list_outer(THREAD_ENTRY *thread_p, SCAN_ID *outer_sid, SCAN_ID *inner_sid, QFILE_LIST_MERGE_INFO *merge_infop, PRED_EXPR *other_outer_join_pred, XASL_STATE *xasl_state, int ls_flag)
static int qexec_check_for_cycle(THREAD_ENTRY *thread_p, OUTPTR_LIST *outptr_list, QFILE_TUPLE tpl, QFILE_TUPLE_VALUE_TYPE_LIST *type_list, QFILE_LIST_ID *list_id_p, int *iscycle)
static int qexec_analytic_eval_instnum_pred(THREAD_ENTRY *thread_p, ANALYTIC_STATE *analytic_state, ANALYTIC_STAGE stage)
aggregate_hash_key * qdata_copy_agg_hkey(cubthread::entry *thread_p, aggregate_hash_key *key)
#define QFILE_CLEAR_LIST_ID(list_id)
int * mvcc_extra_assign_reev
#define ER_LK_UNILATERALLY_ABORTED
int qfile_generate_tuple_into_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, QFILE_TUPLE_TYPE tuple_type)
OUTPTR_LIST * outptr_list
#define XASL_WAIT_MSECS_NOCHANGE
int data_readval(struct or_buf *buf, DB_VALUE *value, const tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len) const
int scan_open_list_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, QFILE_LIST_ID *list_id, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, regu_variable_list_node *regu_list_build, regu_variable_list_node *regu_list_probe, int hash_list_scan_yn)
static DB_OBJLIST * internal_classes
aggregate_hash_value * qdata_alloc_agg_hvalue(cubthread::entry *thread_p, int func_cnt, cubxasl::aggregate_list_node *g_agg_list)
int qdata_get_valptr_type_list(THREAD_ENTRY *thread_p, valptr_list_node *valptr_list_p, qfile_tuple_value_type_list *type_list_p)
REGU_VARIABLE_LIST prior_regu_list_pred
int num_extra_assign_reev
static int qexec_gby_init_group_dim(GROUPBY_STATE *gbstate)
#define ACCESS_SPEC_HFID(ptr)
static void qexec_reset_pseudocolumns_val_pointers(DB_VALUE *level_valp, DB_VALUE *isleaf_valp, DB_VALUE *iscycle_valp, DB_VALUE *parent_pos_valp, DB_VALUE *index_valp)
SORTKEY_INFO * qfile_initialize_sort_key_info(SORTKEY_INFO *key_info_p, SORT_LIST *list_p, QFILE_TUPLE_VALUE_TYPE_LIST *types)
OR_ATTRIBUTE * shared_attrs
TP_DOMAIN_STATUS tp_value_coerce(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
DB_VALUE * heap_attrvalue_get_key(THREAD_ENTRY *thread_p, int btid_index, HEAP_CACHE_ATTRINFO *idx_attrinfo, RECDES *recdes, BTID *btid, DB_VALUE *db_value, char *buf, FUNC_PRED_UNPACK_INFO *func_indx_pred, TP_DOMAIN **key_domain)
REGU_VALUE_ITEM * regu_list
#define QFILE_GET_TUPLE_VALUE_HEADER_POSITION(tpl, ind, valp)
int db_make_datetime(DB_VALUE *value, const DB_DATETIME *datetime)
TP_DOMAIN * original_domain
analytic_ntile_function_info ntile
int db_value_coerce(const DB_VALUE *src, DB_VALUE *dest, const DB_DOMAIN *desired_domain)
static void qexec_clear_connect_by_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
aggregate_specific_function_info info
static int qexec_analytic_evaluate_interpolation_function(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state)
static int qexec_hash_gby_put_next(THREAD_ENTRY *thread_p, const RECDES *recdes, void *arg)
static int qexec_build_agg_hkey(THREAD_ENTRY *thread_p, XASL_STATE *xasl_state, REGU_VARIABLE_LIST regu_list, QFILE_TUPLE tpl, AGGREGATE_HASH_KEY *key)
QFILE_TUPLE_RECORD * output_tplrec
VAL_LIST * prior_val_list
DB_COLLECTION * db_get_set(const DB_VALUE *value)
int qfile_save_tuple(QFILE_TUPLE_DESCRIPTOR *tuple_descr_p, QFILE_TUPLE_TYPE tuple_type, char *page_p, int *tuple_length_p)
MVCC_SNAPSHOT * logtb_get_mvcc_snapshot(THREAD_ENTRY *thread_p)
HEAP_CACHE_ATTRINFO * cache_pred
int mht_clear(MHT_TABLE *ht, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
static SORT_STATUS qexec_gby_get_next(THREAD_ENTRY *thread_p, RECDES *recdes, void *arg)
DB_VALUE ** key_info_values
db_value * temp_dbval_array
void qmgr_set_query_error(THREAD_ENTRY *thread_p, QUERY_ID query_id)
static int qexec_iterate_connect_by_results(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
REGU_VARIABLE_LIST operand
static void qexec_clear_groupby_state(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate)
DB_VALUE * save_instnum_val
STATIC_INLINE int or_get_varchar_compression_lengths(OR_BUF *buf, int *compressed_size, int *decompressed_size) __attribute__((ALWAYS_INLINE))
static int qexec_analytic_finalize_group(THREAD_ENTRY *thread_p, XASL_STATE *xasl_state, ANALYTIC_FUNCTION_STATE *func_state, bool is_same_group)
ACCESS_SPEC_TYPE * merge_spec
DB_VALUE_COMPARE_RESULT tp_value_compare(const DB_VALUE *value1, const DB_VALUE *value2, int allow_coercion, int total_order)
static int qexec_clear_access_spec_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, ACCESS_SPEC_TYPE *list, bool is_final)
TP_DOMAIN tp_Variable_domain
struct qmgr_temp_file * tfile_vfid
update_mvcc_reev_assignment * curr_assigns
OR_FUNCTION_INDEX * func_index_info
regu_variable_node * key_limit_u
static int qexec_ordby_put_next(THREAD_ENTRY *thread_p, const RECDES *recdes, void *arg)
int qdata_get_single_tuple_from_list_id(THREAD_ENTRY *thread_p, qfile_list_id *list_id_p, val_list_node *single_tuple_p)
QFILE_TUPLE_VALUE_TYPE_LIST type_list
#define XASL_TO_BE_CACHED
REGU_VARIABLE_LIST cls_regu_list_key
QFILE_LIST_SCAN_ID value_scan_id
static void qexec_clear_analytic_state(THREAD_ENTRY *thread_p, ANALYTIC_STATE *analytic_state)
multi_index_unique_stats m_unique_stats
OUTPTR_LIST * a_outptr_list_interm
static int qexec_analytic_sort_key_header_load(ANALYTIC_FUNCTION_STATE *func_state, bool load_value)
#define ER_MVCC_SERIALIZABLE_CONFLICT
#define QFILE_PUT_TUPLE_VALUE_FLAG(ptr, val)
#define QFILE_FREE_AND_INIT_LIST_ID(list_id)
static void qexec_reset_regu_variable_list(REGU_VARIABLE_LIST list)
int partition_load_aggregate_helper(PRUNING_CONTEXT *pcontext, access_spec_node *spec, int pruned_count, BTID *root_btid, HIERARCHY_AGGREGATE_HELPER *helper)
regu_variable_node * m_json_reguvar
int locator_start_force_scan_cache(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int op_type)
QFILE_LIST_ID * output_file
DB_TYPE original_opr_dbtype
SCAN_CODE heap_get_visible_version(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn)
DB_VALUE ** cache_page_info
DB_CONST_C_BIT db_get_bit(const DB_VALUE *value, int *length)
int qexec_clear_list_cache_by_class(THREAD_ENTRY *thread_p, const OID *class_oid)
#define TP_IS_SET_TYPE(typenum)
void locator_free_copy_area(LC_COPYAREA *copyarea)
BUILDVALUE_PROC_NODE buildvalue
#define ER_LK_OBJECT_DL_TIMEOUT_CLASS_MSG
int qfile_get_tuple(THREAD_ENTRY *thread_p, PAGE_PTR first_page_p, QFILE_TUPLE tuple, QFILE_TUPLE_RECORD *tuple_record_p, QFILE_LIST_ID *list_id_p)
unsigned int qdata_hash_agg_hkey(const void *key, unsigned int ht_size)
static int qexec_analytic_value_advance(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state, int amount, int max_group_changes, bool ignore_nulls)
void bh_down_heap(BINARY_HEAP *heap, int index)
int session_clear_trace_stats(THREAD_ENTRY *thread_p)
GROUPBY_DIMENSION * g_dim
#define XASL_HAS_CONNECT_BY
int db_seq_get(DB_SET *set, int index, DB_VALUE *value)
int db_get_int(const DB_VALUE *value)
int db_make_bigint(DB_VALUE *value, const DB_BIGINT num)
analytic_list_node * head
static void qexec_clear_sort_list(XASL_NODE *xasl_p, SORT_LIST *list, bool is_final)
static REGU_VARIABLE * replace_null_arith(REGU_VARIABLE *regu_var, DB_VALUE *set_dbval)
int partition_load_pruning_context(THREAD_ENTRY *thread_p, const OID *class_oid, int pruning_type, PRUNING_CONTEXT *pinfo)
#define ER_HEAP_NODATA_NEWADDRESS
int thread_get_recursion_depth(cubthread::entry *thread_p)
#define XASL_G_GRBYNUM_FLAG_SCAN_CONTINUE
#define ER_REFERENCE_TO_NON_REFERABLE_NOT_ALLOWED
#define CONNECTBY_TUPLE_INDEX_STRING_MEM
int qdata_get_tuple_value_size_from_dbval(DB_VALUE *dbval_p)
PAGE_PTR qmgr_get_old_page(THREAD_ENTRY *thread_p, VPID *vpid_p, QMGR_TEMP_FILE *tfile_vfid_p)
static int qexec_execute_cte(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
static int qexec_execute_do_stmt(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
static int qexec_initialize_analytic_function_state(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state, ANALYTIC_TYPE *func_p, XASL_STATE *xasl_state)
int scan_open_heap_page_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, val_list_node *val_list, VAL_DESCR *vd, OID *cls_oid, HFID *hfid, PRED_EXPR *pr, SCAN_TYPE scan_type, DB_VALUE **cache_page_info, regu_variable_list_node *regu_list_page_info)
DB_C_DOUBLE db_get_double(const DB_VALUE *value)
DB_VALUE ** cache_reserved
const int REGU_VARIABLE_HIDDEN_COLUMN
int db_datetime_decode(const DB_DATETIME *datetime, int *month, int *day, int *year, int *hour, int *minute, int *second, int *millisecond)
OR_ATTRIBUTE * class_attrs
void qdata_free_agg_hvalue(cubthread::entry *thread_p, aggregate_hash_value *value)
bool mvcc_is_mvcc_disabled_class(const OID *class_oid)
UPDDEL_CLASS_INFO * classes
SORT_STATUS qfile_make_sort_key(THREAD_ENTRY *thread_p, SORTKEY_INFO *key_info_p, RECDES *key_record_p, QFILE_LIST_SCAN_ID *input_scan_p, QFILE_TUPLE_RECORD *tuple_record_p)
int pr_get_compressed_data_from_buffer(struct or_buf *buf, char *data, int compressed_size, int expected_decompressed_size)
static void qexec_clear_all_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl_list)
static int qexec_setup_topn_proc(THREAD_ENTRY *thread_p, XASL_NODE *xasl, VAL_DESCR *vd)
#define ER_LK_OBJECT_TIMEOUT_SIMPLE_MSG
void bh_to_sorted_array(BINARY_HEAP *heap)
QFILE_SORT_SCAN_ID * s_id
REGU_VARIABLE * limit_row_count
struct analytic_state::@148 curr_sort_page
int SORT_PUT_FUNC(THREAD_ENTRY *thread_p, const RECDES *, void *)
struct tp_domain * setdomain
static int qexec_analytic_update_group_result(THREAD_ENTRY *thread_p, ANALYTIC_STATE *analytic_state)
int mht_rem(MHT_TABLE *ht, const void *key, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
#define QEXEC_EMPTY_ACCESS_SPEC_SCAN(specp)
union xasl_node::@155 proc
#define MIN_NUM_ROWS_FOR_MULTI_DELETE
SCAN_CODE qfile_scan_list_next(THREAD_ENTRY *thread_p, QFILE_LIST_SCAN_ID *scan_id_p, QFILE_TUPLE_RECORD *tuple_record_p, int peek)
static void qexec_replace_prior_regu_vars_pred(THREAD_ENTRY *thread_p, PRED_EXPR *pred, XASL_NODE *xasl)
QFILE_LIST_ID * qfile_sort_list_with_func(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, SORT_LIST *sort_list_p, QUERY_OPTIONS option, int flag, SORT_GET_FUNC *get_func, SORT_PUT_FUNC *put_func, SORT_CMP_FUNC *cmp_func, void *extra_arg, int limit, bool do_close)
#define SCAN_IS_INDEX_COVERED(iscan_id_p)
QFILE_LIST_ID * output_file
static int qexec_execute_increment(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, const HFID *class_hfid, ATTR_ID attrid, int n_increment, int pruning_type)
void set_filters(upddel_mvcc_cond_reeval &ureev)
int extra_assign_reev_cnt
int qdata_evaluate_aggregate_optimize(cubthread::entry *thread_p, cubxasl::aggregate_list_node *agg_p, HFID *hfid_p, OID *super_oid)
#define OR_BUF_INIT(buf, data, size)
bool xcache_uses_clones(void)
#define ER_QPROC_INVALID_XASLNODE
static int qexec_analytic_start_group(THREAD_ENTRY *thread_p, XASL_STATE *xasl_state, ANALYTIC_FUNCTION_STATE *func_state, const RECDES *key, bool reinit)
QFILE_LIST_MERGE_INFO ls_merge
int qdata_set_valptr_list_unbound(THREAD_ENTRY *thread_p, valptr_list_node *valptr_list_p, val_descr *val_desc_p)
multi_index_unique_stats * m_index_stats
static void qexec_clear_pos_desc(XASL_NODE *xasl_p, QFILE_TUPLE_VALUE_POSITION *position_descr, bool is_final)
OR_PARTITION * selected_partition
static int qexec_start_connect_by_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
const void * mht_put(MHT_TABLE *ht, const void *key, void *data)
regu_variable_node * elem
regu_variable_node * percentile_reguvar
void qexec_replace_prior_regu_vars_prior_expr(THREAD_ENTRY *thread_p, regu_variable_node *regu, xasl_node *xasl, xasl_node *connect_by_ptr)
#define ASSERT_ERROR_AND_SET(error_code)
analytic_eval_type * next
ANALYTIC_FUNCTION_STATE * func_state_list
int xehash_destroy(THREAD_ENTRY *thread_p, EHID *ehid)
PRED_EXPR * g_grbynum_pred
OUTPTR_LIST * g_outptr_list
static int qexec_clear_arith_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, ARITH_TYPE *list, bool is_final)
bool thread_need_clear_trace(cubthread::entry *thread_p)
static int qexec_add_composite_lock(THREAD_ENTRY *thread_p, REGU_VARIABLE_LIST reg_var_list, XASL_STATE *xasl_state, LK_COMPOSITE_LOCK *composite_lock, int upd_del_cls_cnt, OID *default_cls_oid)
#define XASL_G_GRBYNUM_FLAG_LIMIT_GT_LT
void tz_get_session_tz_region(TZ_REGION *tz_region)
#define assert_release(e)
QFILE_LIST_SCAN_ID * input_scan
#define LOG_CHECK_LOG_APPLIER(thread_p)
int xtran_server_start_topop(THREAD_ENTRY *thread_p, LOG_LSA *topop_lsa)
static GROUPBY_STATE * qexec_initialize_groupby_state(GROUPBY_STATE *gbstate, SORT_LIST *groupby_list, PRED_EXPR *having_pred, PRED_EXPR *grbynum_pred, DB_VALUE *grbynum_val, int grbynum_flag, XASL_NODE *eptr_list, AGGREGATE_TYPE *g_agg_list, REGU_VARIABLE_LIST g_regu_list, VAL_LIST *g_val_list, OUTPTR_LIST *g_outptr_list, REGU_VARIABLE_LIST g_hk_regu_list, bool with_rollup, int hash_eligible, AGGREGATE_HASH_CONTEXT *agg_hash_context, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_VALUE_TYPE_LIST *type_list, QFILE_TUPLE_RECORD *tplrec)
const char * get_host_name() const
#define QEXEC_CLEAR_AGG_LIST_VALUE(agg_list)
static void qexec_failure_line(int line, XASL_STATE *xasl_state)
int qfile_get_estimated_pages_for_sorting(QFILE_LIST_ID *list_id_p, SORTKEY_INFO *key_info_p)
#define QEXEC_MERGE_OUTER_PREV_SCAN_PVALS(thread_p, pre)
union regu_variable_node::regu_data_value value
static int qexec_listfile_orderby(THREAD_ENTRY *thread_p, XASL_NODE *xasl, QFILE_LIST_ID *list_file, SORT_LIST *orderby_list, XASL_STATE *xasl_state, OUTPTR_LIST *outptr_list)
QFILE_TUPLE_RECORD input_tuple
DB_VALUE_COMPARE_RESULT cmpval(const DB_VALUE *value, const DB_VALUE *value2, int do_coercion, int total_order, int *start_colp, int collation) const
#define CTE_CURR_ITERATION_LAST_TUPLE(node)
REGU_VARIABLE * orderby_limit
int lock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
static int qexec_execute_connect_by(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
SCAN_CODE locator_lock_and_get_object_with_evaluation(THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn, MVCC_REEV_DATA *mvcc_reev_data, NON_EXISTENT_HANDLING non_ex_handling_type)
void log_sysop_start(THREAD_ENTRY *thread_p)
#define HASH_AGGREGATE_VH_SELECTIVITY_THRESHOLD
static SCAN_CODE qexec_next_scan_block(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
int heap_scancache_quick_start_root_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
void lock_abort_composite_lock(LK_COMPOSITE_LOCK *comp_lock)
#define XASL_LINK_TO_REGU_VARIABLE
PRED_EXPR * ordbynum_pred
void set_scan_reevaluation(mvcc_scan_reev_data &scan)
int db_make_date(DB_VALUE *value, const int month, const int day, const int year)
bool oid_is_serial(const OID *oid)
struct timeval TSCTIMEVAL
static DB_LOGICAL qexec_eval_instnum_pred(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
#define OID_SET_NULL(oidp)
ANALYTIC_EVAL_TYPE * a_eval_list
static int qexec_clear_regu_variable_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, REGU_VARIABLE_LIST list, bool is_final)
VALPTR_LIST ** valptr_lists
QFILE_TUPLE_RECORD value_tplrec
TP_DOMAIN tp_Object_domain
TP_DOMAIN * tp_domain_resolve_value(const DB_VALUE *val, TP_DOMAIN *dbuf)
DB_VALUE ** cache_recordinfo
void logtb_get_new_subtransaction_mvccid(THREAD_ENTRY *thread_p, MVCC_INFO *curr_mvcc_info)
int qdata_agg_hkey_eq(const void *key1, const void *key2)
#define TP_IS_STRING_TYPE(typeid)
LOG_TDES * LOG_FIND_TDES(int tran_index)
static void qexec_gby_finalize_group(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate, int N, bool keep_list_file)
static void qexec_clear_pred_xasl(THREAD_ENTRY *thread_p, PRED_EXPR *pred)
void tsc_elapsed_time_usec(TSCTIMEVAL *tv, TSC_TICKS end_tick, TSC_TICKS start_tick)
const char * db_default_expression_string(DB_DEFAULT_EXPR_TYPE default_expr_type)
aggregate_hash_key * qdata_alloc_agg_hkey(cubthread::entry *thread_p, int val_cnt, bool alloc_vals)
qfile_list_id * sorted_part_list_id
#define QEXEC_IS_MULTI_TABLE_UPDATE_DELETE(xasl)
static int qexec_compare_valptr_with_tuple(OUTPTR_LIST *outptr_list, QFILE_TUPLE tpl, QFILE_TUPLE_VALUE_TYPE_LIST *type_list, int *are_equal)
bool REGU_VARIABLE_IS_FLAGED(const regu_variable_node *regu, int flag)
aggregate_accumulator accumulator
static int qexec_orderby_distinct(THREAD_ENTRY *thread_p, XASL_NODE *xasl, QUERY_OPTIONS option, XASL_STATE *xasl_state)
void set_cmpval_function(cmpval_function_type cmpval_arg)
int tz_conv_tz_time_w_zone_name(const DB_TIME *time_source, const char *source_zone, int len_source, const char *dest_zone, int len_dest, DB_TIME *time_dest)
static int qexec_set_pseudocolumns_val_pointers(XASL_NODE *xasl, DB_VALUE **level_valp, DB_VALUE **isleaf_valp, DB_VALUE **iscycle_valp, DB_VALUE **parent_pos_valp, DB_VALUE **index_valp)
MERGELIST_PROC_NODE mergelist
static void qexec_clear_db_val_list(QPROC_DB_VALUE_LIST list)
METHOD_SPEC_TYPE method_node
#define BTID_IS_EQUAL(b1, b2)
TP_DOMAIN tp_Integer_domain
int qdata_copy_valptr_list_to_tuple(THREAD_ENTRY *thread_p, valptr_list_node *valptr_list_p, val_descr *val_desc_p, qfile_tuple_record *tuple_record_p)
int qdata_save_agg_hentry_to_list(cubthread::entry *thread_p, aggregate_hash_key *key, aggregate_hash_value *value, DB_VALUE *temp_dbval_array, qfile_list_id *list_id)
static int qexec_execute_analytic(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, ANALYTIC_EVAL_TYPE *analytic_eval, QFILE_TUPLE_RECORD *tplrec, bool is_last)
int * attrs_prefix_length
void qdata_set_value_list_to_null(val_list_node *val_list_p)
int btree_get_asc_desc(THREAD_ENTRY *thread_p, BTID *btid, int col_idx, int *asc_desc)
#define QPROC_IS_INTERPOLATION_FUNC(func_p)
void scan_end_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id)
#define QEXEC_MERGE_OUTER_PREV_SCAN(thread_p, pre)
void qfile_clear_list_id(QFILE_LIST_ID *list_id_p)
UPDDEL_CLASS_INFO * classes
REGU_VARIABLE_LIST g_regu_list
OUTPTR_LIST * a_outptr_list_interm
int bh_insert(BINARY_HEAP *heap, void *elem)
tp_domain * original_domain
#define PTR_ALIGN(addr, boundary)
qfile_list_scan_id part_scan_id
static int qexec_process_unique_stats(THREAD_ENTRY *thread_p, const OID *class_oid, UPDDEL_CLASS_INFO_INTERNAL *class_)
#define ER_QPROC_CYCLE_DETECTED
int sort_key_tuple_position
int qfile_update_domains_on_type_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, valptr_list_node *valptr_list_p)
int tz_conv_tz_datetime_w_region(const DB_DATETIME *src_dt, const TZ_REGION *src_tz_region, const TZ_REGION *dest_tz_region, DB_DATETIME *dest_dt, TZ_ID *src_tz_id_out, TZ_ID *dest_tz_id_out)
bool * clear_f_val_at_clone_decache
#define OID_AS_ARGS(oidp)
#define QEXEC_MERGE_OUTER_NEXT_SCAN_PVALS(thread_p, pre, e)
int session_reset_cur_insert_id(THREAD_ENTRY *thread_p)
static int qexec_analytic_group_header_load(ANALYTIC_FUNCTION_STATE *func_state)
BUILDLIST_PROC_NODE buildlist
static int qexec_merge_listfiles(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
PRUNING_SCAN_CACHE * locator_get_partition_scancache(PRUNING_CONTEXT *pcontext, const OID *class_oid, const HFID *hfid, int op_type, bool has_function_indexes)
#define ER_MAX_RECURSION_SQL_DEPTH
QFILE_TUPLE_DESCRIPTOR tpl_descr
bool thread_is_on_trace(cubthread::entry *thread_p)
enum tp_domain_status TP_DOMAIN_STATUS
#define er_log_debug(...)
int db_timestamp_encode_sys(const DB_DATE *date, const DB_TIME *timeval, DB_TIMESTAMP *utime, TZ_ID *dest_tz_id)
int qdata_subtract_dbval(DB_VALUE *dbval1_p, DB_VALUE *dbval2_p, DB_VALUE *result_p, tp_domain *domain_p)
int lock_initialize_composite_lock(THREAD_ENTRY *thread_p, LK_COMPOSITE_LOCK *comp_lock)
HL_HEAPID db_change_private_heap(THREAD_ENTRY *thread_p, HL_HEAPID heap_id)
regu_variable_node operand
#define ACCESS_SPEC_SET_PTR(ptr)
#define ACCESS_SPEC_SET_REGU_LIST(ptr)
cub_regex_object * compiled_regex
QFILE_LIST_SCAN_ID group_scan_id
void * mht_get2(const MHT_TABLE *ht, const void *key, void **last)
int heap_scancache_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
aggregate_hash_value * temp_part_value
ACCESS_SPEC_TYPE * inner_spec_list
void qfile_clear_sort_key_info(SORTKEY_INFO *key_info_p)
static int qexec_clear_update_assignment(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, UPDATE_ASSIGNMENT *assignment, bool is_final)
static DB_VALUE_COMPARE_RESULT bf2df_str_cmpdisk(void *mem1, void *mem2, TP_DOMAIN *domain, int do_coercion, int total_order, int *start_colp)
#define ER_NULL_CONSTRAINT_VIOLATION
static int qexec_hash_gby_agg_tuple(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, BUILDLIST_PROC_NODE *proc, QFILE_TUPLE_RECORD *tplrec, QFILE_TUPLE_DESCRIPTOR *tpldesc, QFILE_LIST_ID *groupby_list, bool *output_tuple)
static void qexec_analytic_add_tuple(THREAD_ENTRY *thread_p, ANALYTIC_STATE *analytic_state, QFILE_TUPLE tpl, int peek)
#define CATALOG_ACCESS_INFO_INITIALIZER
const int REGU_VARIABLE_FETCH_NOT_CONST
static int qexec_prune_spec(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *spec, VAL_DESCR *vd, SCAN_OPERATION_TYPE scan_op_type)
int qdata_evaluate_aggregate_hierarchy(cubthread::entry *thread_p, cubxasl::aggregate_list_node *agg_p, HFID *root_hfid, BTID *root_btid, hierarchy_aggregate_helper *helper)
int heap_attrinfo_start_with_index(THREAD_ENTRY *thread_p, OID *class_oid, RECDES *class_recdes, HEAP_CACHE_ATTRINFO *attr_info, HEAP_IDX_ELEMENTS_INFO *idx_info)
#define COPY_OID(dest_oid_ptr, src_oid_ptr)
static int qexec_locate_agg_hentry_in_list(THREAD_ENTRY *thread_p, AGGREGATE_HASH_CONTEXT *context, AGGREGATE_HASH_KEY *key, bool *found)
QFILE_TUPLE_VALUE_FLAG qfile_locate_tuple_value(QFILE_TUPLE tuple, int index, char **tuple_value_p, int *value_size_p)
LOCK lock_get_object_lock(const OID *oid, const OID *class_oid)
static SCAN_CODE qexec_merge_fnc(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec, XASL_SCAN_FNC_PTR ignore)
static DEL_LOB_INFO * qexec_create_delete_lob_info(THREAD_ENTRY *thread_p, XASL_STATE *xasl_state, UPDDEL_CLASS_INFO_INTERNAL *class_info)
SELUPD_LIST * selected_upd_list
#define DB_VALUE_SCALE(value)
DB_ELO * db_get_elo(const DB_VALUE *value)
#define XASL_ORDBYNUM_FLAG_SCAN_STOP
static DB_VALUE_COMPARE_RESULT qexec_cmp_tpl_vals_merge(QFILE_TUPLE *left_tval, TP_DOMAIN **left_dom, QFILE_TUPLE *rght_tval, TP_DOMAIN **rght_dom, int tval_cnt)
int xlogtb_reset_wait_msecs(THREAD_ENTRY *thread_p, int wait_msecs)
PRED_EXPR * ordbynum_pred
REGU_VARIABLE_LIST list_regu_list_probe
static int qexec_groupby(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
#define QEXEC_MERGE_NEXT_SCAN_PVALS(thread_p, pre, e)
REGU_VARIABLE_LIST list_regu_list_build
int catalog_start_access_with_dir_oid(THREAD_ENTRY *thread_p, CATALOG_ACCESS_INFO *catalog_access_info, LOCK lock_mode)
int db_elo_delete(DB_ELO *elo)
int scan_open_index_key_info_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, val_list_node *val_list, VAL_DESCR *vd, indx_info *indx_info, OID *cls_oid, HFID *hfid, PRED_EXPR *pr, valptr_list_node *output_val_list, bool iscan_oid_order, QUERY_ID query_id, DB_VALUE **key_info_values, regu_variable_list_node *key_info_regu_list)
int qdata_get_agg_hvalue_size(aggregate_hash_value *value, bool ret_delta)
static int qexec_init_index_pseudocolumn_strings(THREAD_ENTRY *thread_p, char **father_index, int *len_father_index, char **son_index, int *len_son_index)
REGU_VARIABLE_LIST g_hk_regu_list
QFILE_LIST_ID * value_list_id
void xlogtb_set_interrupt(THREAD_ENTRY *thread_p, int set)
#define QEXEC_MERGE_PREV_SCAN(thread_p, pre)
#define REINTERPRET_CAST(dest_type, expr)
void qdata_free_agg_hkey(cubthread::entry *thread_p, aggregate_hash_key *key)
TP_DOMAIN tp_Double_domain
DB_DEFAULT_EXPR_TYPE default_expr_type
static int qexec_orderby_distinct_by_sorting(THREAD_ENTRY *thread_p, XASL_NODE *xasl, QUERY_OPTIONS option, XASL_STATE *xasl_state)
TP_DOMAIN * original_domain
void set_data_cmpdisk_function(data_cmpdisk_function_type data_cmpdisk_arg)
HEAP_CACHE_ATTRINFO * attr_info
QFILE_LIST_ID * output_file
const char * lang_get_collation_name(const int coll_id)
#define XASL_NEED_SINGLE_TUPLE_SCAN
static void qexec_gby_agg_tuple(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate, QFILE_TUPLE tpl, int peek)
BTREE_SEARCH xbtree_find_unique(THREAD_ENTRY *thread_p, BTID *btid, SCAN_OPERATION_TYPE scan_op_type, DB_VALUE *key, OID *class_oid, OID *oid, bool is_all_class_srch)
#define ACCESS_SPEC_CONNECT_BY_LIST_ID(ptr)
int db_make_string(DB_VALUE *value, DB_CONST_C_CHAR str)
SCAN_OPERATION_TYPE scan_op_type
int heap_scancache_start(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int cache_last_fix_page, int is_indexscan, MVCC_SNAPSHOT *mvcc_snapshot)
static int qexec_analytic_put_next(THREAD_ENTRY *thread_p, const RECDES *recdes, void *arg)
static SCAN_CODE qexec_init_next_partition(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *spec)
UINT64 prm_get_bigint_value(PARAM_ID prm_id)
DB_LOGICAL eval_pred(THREAD_ENTRY *thread_p, const PRED_EXPR *pr, val_descr *vd, OID *obj_oid)
void port_close_memstream(FILE *fp, char **ptr, size_t *sizeloc)
int sort_listfile(THREAD_ENTRY *thread_p, INT16 volid, int est_inp_pg_cnt, SORT_GET_FUNC *get_fn, void *get_arg, SORT_PUT_FUNC *put_fn, void *put_arg, SORT_CMP_FUNC *cmp_fn, void *cmp_arg, SORT_DUP_OPTION option, int limit, bool includes_tde_class)
void mht_destroy(MHT_TABLE *ht)
COUNT_OPTIM_STATE count_state
SORT_LIST * qfile_allocate_sort_list(THREAD_ENTRY *thread_p, int count)
#define QFILE_GET_TUPLE_VALUE_FLAG(ptr)
bool pr_is_set_type(DB_TYPE type)
#define QFILE_MAX_TUPLE_SIZE_IN_PAGE
void partition_clear_pruning_context(PRUNING_CONTEXT *pinfo)
HEAP_CACHE_ATTRINFO * cache_rest
GROUPBY_DIMENSION_FLAG d_flag
DB_DEFAULT_EXPR_TYPE on_update_expr
#define ACCESS_SPEC_METHOD_SIG_LIST(ptr)
QFILE_TUPLE_RECORD input_tplrec
int heap_attrinfo_start(THREAD_ENTRY *thread_p, const OID *class_oid, int requested_num_attrs, const ATTR_ID *attrids, HEAP_CACHE_ATTRINFO *attr_info)
unsigned int DB_TIMESTAMP
PR_TYPE * pr_type_from_id(DB_TYPE id)
XASL_NODE * recursive_part
bool bh_is_full(BINARY_HEAP *heap)
int db_unix_timestamp(const DB_VALUE *src_date, DB_VALUE *result_timestamp)
DEL_LOB_INFO * crt_del_lob_info
EHID * xehash_create(THREAD_ENTRY *thread_p, EHID *ehid, DB_TYPE key_type, int exp_num_entries, OID *class_oid, int attr_id, bool is_tmp)
#define RECDES_INITIALIZER
AGGREGATE_TYPE * g_output_agg_list
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
int db_string_concatenate(const DB_VALUE *string1, const DB_VALUE *string2, DB_VALUE *result, DB_DATA_STATUS *data_status)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int catalog_end_access_with_dir_oid(THREAD_ENTRY *thread_p, CATALOG_ACCESS_INFO *catalog_access_info, int error)
SCAN_CODE scan_reset_scan_block(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
static int qexec_execute_obj_fetch(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, SCAN_OPERATION_TYPE scan_operation_type)
QPROC_QUALIFICATION * qualification
PRED_EXPR * start_with_pred
cubxasl::pred_expr * pred
static void qexec_clear_mainblock_iterations(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
analytic_percentile_function_info percentile
int db_set_get(DB_SET *set, int index, DB_VALUE *value)
static void qexec_replace_prior_regu_vars(THREAD_ENTRY *thread_p, REGU_VARIABLE *regu, XASL_NODE *xasl)
void bh_destroy(THREAD_ENTRY *thread_p, BINARY_HEAP *heap)
#define XASL_SET_FLAG(x, f)
#define ACCESS_SPEC_METHOD_LIST_ID(ptr)
LOCK locator_get_lock_mode_from_op_type(SCAN_OPERATION_TYPE op_type)
int db_value_put_encoded_time(DB_VALUE *value, const DB_TIME *time)
#define ER_QPROC_INVALID_PARAMETER
#define ACCESS_SPEC_RLIST_VALPTR_LIST(ptr)
#define DB_MAX_NUMERIC_PRECISION
SCAN_CODE qfile_scan_list_prev(THREAD_ENTRY *thread_p, QFILE_LIST_SCAN_ID *scan_id_p, QFILE_TUPLE_RECORD *tuple_record_p, int peek)
const char * or_get_constraint_comment(RECDES *record, const char *constraint_name)
QFILE_LIST_ID * qfile_combine_two_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *lhs_file_p, QFILE_LIST_ID *rhs_file_p, int flag)
ACCESS_SPEC_TYPE * curr_spec
static int qexec_get_orderbynum_upper_bound(THREAD_ENTRY *tread_p, PRED_EXPR *pred, VAL_DESCR *vd, DB_VALUE *ubound)
QFILE_TUPLE_RECORD * tplrec1
REGU_VARIABLE * func_regu
bool qdump_print_xasl(xasl_node *xasl_p)
const VOLID LOG_DBFIRST_VOLID
#define XASL_TOP_MOST_XASL
QPROC_TPLDESCR_STATUS qdata_generate_tuple_desc_for_valptr_list(THREAD_ENTRY *thread_p, valptr_list_node *valptr_list_p, val_descr *val_desc_p, qfile_tuple_descriptor *tuple_desc_p)
static BH_CMP_RESULT qexec_topn_cmpval(DB_VALUE *left, DB_VALUE *right, SORT_LIST *sort_spec)
CONNECTBY_PROC_NODE connect_by
static SCAN_CODE qexec_intprt_fnc(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec, XASL_SCAN_FNC_PTR next_scan_fnc)
static int qexec_clear_pred(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, PRED_EXPR *pr, bool is_final)
int scan_open_showstmt_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, PRED_EXPR *pr, SHOWSTMT_TYPE show_type, regu_variable_list_node *arg_list)
#define XASL_G_GRBYNUM_FLAG_SCAN_CHECK
regu_variable_list_node * key_info_regu_list
static int qexec_upddel_mvcc_set_filters(THREAD_ENTRY *thread_p, XASL_NODE *aptr_list, UPDDEL_MVCC_COND_REEVAL *mvcc_reev_class, OID *class_oid)
void fetch_init_val_list(regu_variable_list_node *regu_list)
REGU_VARIABLE_LIST after_cb_regu_list_rest
#define DB_DOUBLE_DECIMAL_PRECISION
int qfile_add_overflow_tuple_to_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, PAGE_PTR ovf_tuple_page_p, QFILE_LIST_ID *input_list_id_p)
static int qexec_end_buildvalueblock_iterations(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
int prm_get_integer_value(PARAM_ID prm_id)
#define XASL_G_GRBYNUM_FLAG_SCAN_STOP
#define XASL_ORDBYNUM_FLAG_SCAN_CHECK
unsigned is_autoincrement
PRUNING_SCAN_CACHE scan_cache
OR_DEFAULT_VALUE default_value
static UPDDEL_MVCC_COND_REEVAL * qexec_mvcc_cond_reev_set_scan_order(XASL_NODE *aptr, UPDDEL_MVCC_COND_REEVAL *reev_classes, int num_reev_classes, UPDDEL_CLASS_INFO *classes, int num_classes)
bool scan_immediately_stop
#define ER_BUILDVALUE_IN_REC_CTE
int partition_find_root_class_oid(THREAD_ENTRY *thread_p, const OID *class_oid, OID *super_oid)
#define XASL_INSTNUM_FLAG_SCAN_LAST_STOP
int tp_domain_status_er_set(TP_DOMAIN_STATUS status, const char *file_name, const int line_no, const DB_VALUE *src, const TP_DOMAIN *domain)
QFILE_LIST_SCAN_ID * interm_scan
qfile_list_id * part_list_id
QFILE_TUPLE_RECORD * output_tplrec
int scan_open_method_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, QFILE_LIST_ID *list_id, method_sig_list *meth_sig_list)
void scan_save_scan_pos(SCAN_ID *s_id, SCAN_POS *scan_pos)
void qfile_destroy_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p)
int qfile_set_tuple_column_value(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, PAGE_PTR curr_page_p, VPID *vpid_p, QFILE_TUPLE tuple_p, int col_num, DB_VALUE *value_p, TP_DOMAIN *domain_p)
static ANALYTIC_STATE * qexec_initialize_analytic_state(THREAD_ENTRY *thread_p, ANALYTIC_STATE *analytic_state, ANALYTIC_TYPE *a_func_list, SORT_LIST *sort_list, REGU_VARIABLE_LIST a_regu_list, VAL_LIST *a_val_list, OUTPTR_LIST *a_outptr_list, OUTPTR_LIST *a_outptr_list_interm, bool is_last_run, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_VALUE_TYPE_LIST *type_list, QFILE_TUPLE_RECORD *tplrec)
int partition_prune_unique_btid(PRUNING_CONTEXT *pcontext, DB_VALUE *key, OID *class_oid, HFID *class_hfid, BTID *btid)
OR_ATTRIBUTE * heap_locate_last_attrepr(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
regu_variable_list_node * regu_list
int qfile_compare_all_sort_record(const void *pk0, const void *pk1, void *arg)
static int qexec_merge_tuple(QFILE_TUPLE_RECORD *tplrec1, QFILE_TUPLE_RECORD *tplrec2, QFILE_LIST_MERGE_INFO *merge_info, QFILE_TUPLE_RECORD *tplrec)
#define ER_OUT_OF_VIRTUAL_MEMORY
XSAL_SCAN_FUNC * XASL_SCAN_FNC_PTR
int qdata_finalize_aggregate_list(cubthread::entry *thread_p, cubxasl::aggregate_list_node *agg_list_p, bool keep_list_file)
static int qexec_fill_sort_limit(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, int *limit_ptr)
int or_get_attrcomment(RECDES *record, int attrid, char **string, int *alloced_string)
int qdata_evaluate_analytic_func(cubthread::entry *thread_p, ANALYTIC_TYPE *func_p, VAL_DESCR *val_desc_p)
DB_TYPE db_value_type(const DB_VALUE *value)
bool clear_value_at_clone_decache
const char * db_json_get_schema_raw_from_validator(JSON_VALIDATOR *val)
HEAP_CACHE_ATTRINFO attr_info
const char * qdump_operator_type_string(OPERATOR_TYPE optype)
static int qexec_recalc_tuples_parent_pos_in_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p)
#define ANALYTIC_FUNC_SET_FLAG(x, f)
static int qexec_evaluate_partition_aggregates(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *spec, AGGREGATE_TYPE *agg_list, bool *is_scan_needed)
REGU_VARIABLE_LIST list_regu_list_pred
TRAN_ISOLATION logtb_find_current_isolation(THREAD_ENTRY *thread_p)
HEAP_CACHE_ATTRINFO * cache_range
#define SINGLE_ROW_UPDATE
static ACCESS_SPEC_TYPE * query_multi_range_opt_check_specs(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
const int REGU_VARIABLE_CLEAR_AT_CLONE_DECACHE
static void qexec_resolve_domains_on_sort_list(SORT_LIST *order_list, REGU_VARIABLE_LIST reference_regu_list)
union cubxasl::pred_expr::@185 pe
int qdata_load_agg_hentry_from_tuple(cubthread::entry *thread_p, QFILE_TUPLE tuple, aggregate_hash_key *key, aggregate_hash_value *value, tp_domain **key_dom, cubxasl::aggregate_accumulator_domain **acc_dom)
int fetch_peek_dbval(THREAD_ENTRY *thread_p, REGU_VARIABLE *regu_var, val_descr *vd, OID *class_oid, OID *obj_oid, QFILE_TUPLE tpl, DB_VALUE **peek_dbval)
QFILE_TUPLE_RECORD input_tpl
int curr_group_tuple_count_nn
#define DB_VALUE_DOMAIN_TYPE(value)
int db_value_free(DB_VALUE *value)
regu_variable_node * percentile_reguvar
static int qexec_gby_finalize_group_dim(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate, const RECDES *recdes)
static void qexec_clear_scan_all_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl_list)
int scan_open_set_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, REGU_VARIABLE *set_ptr, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr)
#define ER_QUERY_EXECUTION_ERROR
UPDATE_ASSIGNMENT * assigns
struct function_node * funcp
void * ehash_insert(THREAD_ENTRY *thread_p, EHID *ehid_p, void *key_p, OID *value_p)
void qfile_save_current_scan_tuple_position(QFILE_LIST_SCAN_ID *scan_id_p, QFILE_TUPLE_POSITION *tuple_position_p)
#define TP_DOMAIN_COLLATION(dom)
static DB_LOGICAL qexec_eval_ordbynum_pred(THREAD_ENTRY *thread_p, ORDBYNUM_INFO *ordby_info)
#define TP_IS_NUMERIC_TYPE(typeid)
static void qexec_clear_topn_tuple(THREAD_ENTRY *thread_p, TOPN_TUPLE *tuple, int count)
struct upddel_class_info_internal UPDDEL_CLASS_INFO_INTERNAL
static int qexec_get_attr_default(THREAD_ENTRY *thread_p, OR_ATTRIBUTE *attr, DB_VALUE *default_val)
QMGR_TEMP_FILE * qmgr_create_new_temp_file(THREAD_ENTRY *thread_p, QUERY_ID query_id, QMGR_TEMP_FILE_MEMBUF_TYPE membuf_type)
REGU_VARIABLE_LIST cls_regu_val_list
struct drand48_data * rand_seed
json_table_spec_node json_table_node
#define XASL_OBJFETCH_IGNORE_CLASSOID
#define IS_ANY_INDEX_ACCESS(access_)
#define VPID_EQ(vpid_ptr1, vpid_ptr2)
int qdata_aggregate_accumulator_to_accumulator(cubthread::entry *thread_p, cubxasl::aggregate_accumulator *acc, cubxasl::aggregate_accumulator_domain *acc_dom, FUNC_TYPE func_type, tp_domain *func_domain, cubxasl::aggregate_accumulator *new_acc)
HEAP_ATTRVALUE * heap_attrvalue_locate(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
int scan_open_class_attr_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, OID *cls_oid, HFID *hfid, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, int num_attrs_pred, ATTR_ID *attrids_pred, HEAP_CACHE_ATTRINFO *cache_pred, int num_attrs_rest, ATTR_ID *attrids_rest, HEAP_CACHE_ATTRINFO *cache_rest)
REGU_VARIABLE_LIST method_regu_list
static int qexec_execute_merge(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
REGU_VARIABLE * level_regu
SHOWSTMT_SPEC_TYPE showstmt_node
int qexec_insert_tuple_into_list(THREAD_ENTRY *thread_p, qfile_list_id *list_id, valptr_list_node *outptr_list, val_descr *vd, qfile_tuple_record *tplrec)
ARITH_TYPE * outarith_list
OUTPTR_LIST * a_outptr_list
TRAN_STATE xtran_server_end_topop(THREAD_ENTRY *thread_p, LOG_RESULT_TOPOP result, LOG_LSA *topop_lsa)
QFILE_TUPLE qfile_generate_sort_tuple(SORTKEY_INFO *key_info_p, SORT_REC *sort_record_p, RECDES *output_recdes_p)
REGU_VARIABLE_LIST a_regu_list
static void qexec_clear_internal_classes(THREAD_ENTRY *thread_p, UPDDEL_CLASS_INFO_INTERNAL *classes, int count)
tp_domain * original_domain
#define PCOL_FIRST_TUPLE_OFFSET
#define OID_EQ(oidp1, oidp2)
static QFILE_LIST_ID * qexec_merge_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *outer_list_idp, QFILE_LIST_ID *inner_list_idp, QFILE_LIST_MERGE_INFO *merge_infop, int ls_flag)
static void qexec_close_scan(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *curr_spec)
int qdata_get_agg_hkey_size(aggregate_hash_key *key)
static int qexec_execute_delete(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
int db_string_put_cs_and_collation(DB_VALUE *value, const int codeset, const int collation_id)
#define heap_classrepr_free_and_init(class_repr, idxp)
DB_VALUE * db_value_copy(DB_VALUE *value)
SCAN_CODE scan_next_scan_block(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
int qexec_clear_xasl(THREAD_ENTRY *thread_p, xasl_node *xasl, bool is_final)
TP_DOMAIN_STATUS tp_value_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
int heap_attrinfo_read_dbvalues(THREAD_ENTRY *thread_p, const OID *inst_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info)
static long qexec_size_remaining(QFILE_TUPLE_RECORD *tplrec1, QFILE_TUPLE_RECORD *tplrec2, QFILE_LIST_MERGE_INFO *merge_info, int k)
int locator_attribute_info_force(THREAD_ENTRY *thread_p, const HFID *hfid, OID *oid, HEAP_CACHE_ATTRINFO *attr_info, ATTR_ID *att_id, int n_att_id, LC_COPYAREA_OPERATION operation, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, bool not_check_fk, REPL_INFO_TYPE repl_info, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, MVCC_REEV_DATA *mvcc_reev_data, UPDATE_INPLACE_STYLE force_update_inplace, RECDES *rec_descriptor, bool need_locking)
#define TP_DOMAIN_TYPE(dom)
REGU_VARIABLE * iscycle_regu
PRED_EXPR * after_connect_by_pred
aggregate_hash_value * curr_part_value
int db_datetime_to_timestamp(const DB_VALUE *src_datetime, DB_VALUE *result_timestamp)
update_mvcc_reev_assignment * next
#define ACCESS_SPEC_CLS_OID(ptr)
#define COMPOSITE_LOCK(scan_op_type)
#define PCOL_ISLEAF_TUPLE_OFFSET
#define XASL_NO_FIXED_SCAN
#define HASH_AGGREGATE_VH_SELECTIVITY_TUPLE_THRESHOLD
SCAN_CODE qfile_jump_scan_tuple_position(THREAD_ENTRY *thread_p, QFILE_LIST_SCAN_ID *scan_id_p, QFILE_TUPLE_POSITION *tuple_position_p, QFILE_TUPLE_RECORD *tuple_record_p, int peek)
int qexec_clear_partition_expression(THREAD_ENTRY *thread_p, regu_variable_node *expr)
static int qexec_init_agg_hierarchy_helpers(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *spec, AGGREGATE_TYPE *aggregate_list, HIERARCHY_AGGREGATE_HELPER **helpers, int *helpers_countp)
#define XASL_MULTI_UPDATE_AGG
static void cleanup(int signo)
int qexec_get_tuple_column_value(QFILE_TUPLE tpl, int index, DB_VALUE *valp, tp_domain *domain)
int qexec_start_mainblock_iterations(THREAD_ENTRY *thread_p, xasl_node *xasl, xasl_state *xasl_state)
#define QFILE_GET_TUPLE_VALUE_LENGTH(ptr)
void * mht_get(MHT_TABLE *ht, const void *key)
AGGREGATE_TYPE * d_agg_list
void lock_stop_instant_lock_mode(THREAD_ENTRY *thread_p, int tran_index, bool need_unlock)
int scan_open_values_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, valptr_list_node *valptr_list)
int g_agg_domains_resolved
static void qexec_destroy_upddel_ehash_files(THREAD_ENTRY *thread_p, XASL_NODE *buildlist)
#define HASH_AGGREGATE_DEFAULT_TABLE_SIZE
int qfile_reopen_list_as_append_mode(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p)
void qfile_free_sort_list(THREAD_ENTRY *thread_p, SORT_LIST *sort_list_p)
#define QFILE_TUPLE_LENGTH_SIZE
#define XASL_IS_FLAGED(x, f)
static int qexec_execute_duplicate_key_update(THREAD_ENTRY *thread_p, ODKU_INFO *odku, HFID *hfid, VAL_DESCR *vd, int op_type, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info, HEAP_CACHE_ATTRINFO *index_attr_info, HEAP_IDX_ELEMENTS_INFO *idx_info, int pruning_type, PRUNING_CONTEXT *pcontext, int *force_count)
XASL_NODE * connect_by_ptr
static SCAN_CODE qexec_next_merge_block(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE **spec)
int heap_attrinfo_clear_dbvalues(HEAP_CACHE_ATTRINFO *attr_info)
upddel_mvcc_cond_reeval * mvcc_cond_reev_list
REGU_VARIABLE_LIST regu_list_rest
ACCESS_SCHEMA_TYPE schema_type
REGU_VARIABLE_LIST regu_list_pred
static void qexec_end_scan(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *curr_spec)
#define QFILE_GET_TUPLE_LENGTH(tpl)
int session_set_trace_stats(THREAD_ENTRY *thread_p, char *stats, int format)
void tz_get_system_tz_region(TZ_REGION *tz_region)
#define QPROC_SINGLE_CLASS_GROUPED_SCAN
OUTPTR_LIST * a_outptr_list_ex
UPDATE_MVCC_REEV_ASSIGNMENT * mvcc_reev_assigns
void tsc_getticks(TSC_TICKS *tck)
bool bh_peek_max(BINARY_HEAP *heap, void *peek_elem)
static int qexec_clear_xasl_head(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
int group_tuple_position_nn
REGU_VARIABLE_LIST after_cb_regu_list_pred
#define XASL_DECACHE_CLONE
int lock_subclass(THREAD_ENTRY *thread_p, const OID *subclass_oid, const OID *superclass_oid, LOCK lock, int cond_flag)
int lock_add_composite_lock(THREAD_ENTRY *thread_p, LK_COMPOSITE_LOCK *comp_lock, const OID *oid, const OID *class_oid)
int group_consumed_tuples
QFILE_TUPLE_VALUE_POSITION pos_descr
#define SCAN_IS_INDEX_MRO(iscan_id_p)
static int qexec_get_index_pseudocolumn_value_from_tuple(THREAD_ENTRY *thread_p, XASL_NODE *xasl, QFILE_TUPLE tpl, DB_VALUE **index_valp, char **index_value, int *index_len)
static void qexec_gby_clear_group_dim(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate)
static void qexec_gby_finalize_group_val_list(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate, int N)
int qfile_fast_intval_tuple_to_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, int v1, DB_VALUE *v2)
#define SINGLE_ROW_DELETE
static int qexec_schema_get_type_desc(DB_TYPE id, TP_DOMAIN *domain, DB_VALUE *result)
void qfile_update_qlist_count(THREAD_ENTRY *thread_p, const QFILE_LIST_ID *list_p, int inc)
int * ls_outer_inner_list
void locator_end_force_scan_cache(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
static const char * qexec_schema_get_type_name_from_id(DB_TYPE id)
static int qexec_analytic_evaluate_ntile_function(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state)
#define ANALYTIC_KEEP_RANK
aggregate_list_node * next
int qdata_finalize_analytic_func(cubthread::entry *thread_p, ANALYTIC_TYPE *func_p, bool is_same_group)
static void qexec_resolve_domains_for_group_by(BUILDLIST_PROC_NODE *buildlist, OUTPTR_LIST *reference_out_list)
#define db_private_free_and_init(thrd, ptr)
int db_value_put_encoded_date(DB_VALUE *value, const DB_DATE *date)
void PRIM_SET_NULL(DB_VALUE *value)
static void qexec_free_agg_hash_context(THREAD_ENTRY *thread_p, BUILDLIST_PROC_NODE *proc)
static int qexec_init_instnum_val(XASL_NODE *xasl, THREAD_ENTRY *thread_p, XASL_STATE *xasl_state)
AGGREGATE_HASH_STATE state
int scan_open_index_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, bool mvcc_select_lock_needed, SCAN_OPERATION_TYPE scan_op_type, int fixed, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, indx_info *indx_info, OID *cls_oid, HFID *hfid, regu_variable_list_node *regu_list_key, PRED_EXPR *pr_key, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, PRED_EXPR *pr_range, regu_variable_list_node *regu_list_range, valptr_list_node *output_val_list, regu_variable_list_node *regu_val_list, int num_attrs_key, ATTR_ID *attrids_key, HEAP_CACHE_ATTRINFO *cache_key, int num_attrs_pred, ATTR_ID *attrids_pred, HEAP_CACHE_ATTRINFO *cache_pred, int num_attrs_rest, ATTR_ID *attrids_rest, HEAP_CACHE_ATTRINFO *cache_rest, int num_attrs_range, ATTR_ID *attrids_range, HEAP_CACHE_ATTRINFO *cache_range, bool iscan_oid_order, QUERY_ID query_id)
MHT_TABLE * mht_create(const char *name, int est_size, unsigned int(*hash_func)(const void *key, unsigned int ht_size), int(*cmp_func)(const void *key1, const void *key2))
void partition_init_pruning_context(PRUNING_CONTEXT *pinfo)
int curr_extra_assign_cnt
#define QEXEC_MERGE_PVALS(pre)
REGU_VARIABLE_LIST list_regu_list_rest
int catalog_get_dir_oid_from_cache(THREAD_ENTRY *thread_p, const OID *class_id_p, OID *dir_oid_p)
int logtb_tran_update_unique_stats(THREAD_ENTRY *thread_p, const BTID *btid, int n_keys, int n_oids, int n_nulls, bool write_to_log)
#define db_private_free(thrd, ptr)
void or_init(OR_BUF *buf, char *data, int length)
AGGREGATE_TYPE * agg_list
enum groupby_dimension_flag GROUPBY_DIMENSION_FLAG
#define db_private_alloc(thrd, size)
#define CONST_CAST(dest_type, expr)
SCAN_CODE scan_jump_scan_pos(THREAD_ENTRY *thread_p, SCAN_ID *s_id, SCAN_POS *scan_pos)
OR_PARTITION * partitions
static int qexec_resolve_domains_for_aggregation(THREAD_ENTRY *thread_p, AGGREGATE_TYPE *agg_p, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec, REGU_VARIABLE_LIST regu_list, int *resolved)
QFILE_LIST_ID * push_list_id
LOG_TRAN_CLASS_COS * logtb_tran_find_class_cos(THREAD_ENTRY *thread_p, const OID *class_oid, bool create)
static void qexec_reset_pred_expr(PRED_EXPR *pred)
need_clear_type need_clear
#define XASL_INSTNUM_FLAG_SCAN_STOP_AT_ANALYTIC
int or_set_rep_id(RECDES *record, int repid)
UPDDEL_MVCC_COND_REEVAL ** mvcc_extra_assign_reev
static int query_multi_range_opt_check_set_sort_col(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
bool logtb_set_check_interrupt(THREAD_ENTRY *thread_p, bool flag)
static SORT_STATUS qexec_analytic_get_next(THREAD_ENTRY *thread_p, RECDES *recdes, void *arg)
static int qexec_create_internal_classes(THREAD_ENTRY *thread_p, UPDDEL_CLASS_INFO *classes_info, int count, UPDDEL_CLASS_INFO_INTERNAL **classes)
int db_set_size(DB_SET *set)
int qdata_evaluate_aggregate_list(cubthread::entry *thread_p, cubxasl::aggregate_list_node *agg_list_p, val_descr *val_desc_p, cubxasl::aggregate_accumulator *alt_acc_list)
OR_CLASSREP * heap_classrepr_get(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *class_recdes, REPR_ID reprid, int *idx_incache)
#define QFILE_PUT_TUPLE_VALUE_LENGTH(ptr, val)
int count(int &result, const cub_regex_object ®, const std::string &src, const int position, const INTL_CODESET codeset)
int pr_clear_value(DB_VALUE *value)
int qfile_open_list_scan(QFILE_LIST_ID *list_id_p, QFILE_LIST_SCAN_ID *scan_id_p)
int qdata_initialize_analytic_func(cubthread::entry *thread_p, ANALYTIC_TYPE *func_p, QUERY_ID query_id)
void qmgr_add_modified_class(THREAD_ENTRY *thread_p, const OID *class_oid_p)
qfile_tuple_record first_tuple
bool is_scan_cache_started
HEAP_CACHE_ATTRINFO attr_info
#define XASL_G_GRBYNUM_FLAG_LIMIT_LT
DB_DOMAIN * db_type_to_db_domain(const DB_TYPE type)
#define PCOL_INDEX_STRING_TUPLE_OFFSET
DB_VALUE_COMPARE_RESULT qdata_agg_hkey_compare(aggregate_hash_key *ckey1, aggregate_hash_key *ckey2, int *diff_pos)
int db_make_time(DB_VALUE *value, const int hour, const int minute, const int second)
SCAN_CODE qdata_load_agg_hentry_from_list(cubthread::entry *thread_p, qfile_list_scan_id *list_scan_id, aggregate_hash_key *key, aggregate_hash_value *value, tp_domain **key_dom, cubxasl::aggregate_accumulator_domain **acc_dom)
cubxasl::pred_expr * cons_pred
#define VFID_COPY(vfid_ptr1, vfid_ptr2)
int qexec_execute_mainblock(THREAD_ENTRY *thread_p, xasl_node *xasl, xasl_state *xstate, UPDDEL_CLASS_INSTANCE_LOCK_INFO *p_class_instance_lock_info)
void log_sysop_abort(THREAD_ENTRY *thread_p)
upddel_mvcc_cond_reeval * next
static int bf2df_str_son_index(THREAD_ENTRY *thread_p, char **son_index, char *father_index, int *len_son_index, int cnt)
AGGREGATE_TYPE * g_agg_list
static int qexec_collection_has_null(DB_VALUE *colval)
static int qexec_setup_list_id(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
static int qexec_alloc_agg_hash_context(THREAD_ENTRY *thread_p, BUILDLIST_PROC_NODE *proc, XASL_STATE *xasl_state)
int scan_open_json_table_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, PRED_EXPR *pr)
struct db_domain_info::general_info general_info
#define QFILE_SET_FLAG(var, flag)
#define PCOL_PARENTPOS_TUPLE_OFFSET
static int qexec_topn_tuples_to_list_id(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, bool is_final)
struct SORT_REC::@159::@160 original
PRED_EXPR * after_join_pred
void util_get_second_and_ms_since_epoch(time_t *secs, int *msec)
void init(scan_id_struct &sid)
static int qexec_merge_tuple_add_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id, QFILE_TUPLE_RECORD *tplrec1, QFILE_TUPLE_RECORD *tplrec2, QFILE_LIST_MERGE_INFO *merge_info, QFILE_TUPLE_RECORD *tplrec)
void lock_start_instant_lock_mode(int tran_index)
static int qexec_execute_update(THREAD_ENTRY *thread_p, XASL_NODE *xasl, bool has_delete, XASL_STATE *xasl_state)
DB_ENUMERATION enumeration
const char * envvar_get(const char *name)
#define TP_IS_CHAR_TYPE(typeid)
#define ER_BTREE_UNIQUE_FAILED
QFILE_LIST_ID * interm_file
int fetch_val_list(THREAD_ENTRY *thread_p, regu_variable_list_node *regu_list, val_descr *vd, OID *class_oid, OID *obj_oid, QFILE_TUPLE tpl, int peek)
static void error(const char *msg)
LC_COPYAREA * locator_allocate_copy_area_by_attr_info(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, RECDES *new_recdes, const int copyarea_length_hint, int lob_create_flag)
static int qexec_clear_regu_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, REGU_VARIABLE_LIST list, bool is_final)
void scan_close_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id)
SCANCACHE_LIST * scan_cache_list
#define XASL_SKIP_ORDERBY_LIST
static int qexec_gby_put_next(THREAD_ENTRY *thread_p, const RECDES *recdes, void *arg)
static int qexec_remove_duplicates_for_replace(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info, HEAP_CACHE_ATTRINFO *index_attr_info, const HEAP_IDX_ELEMENTS_INFO *idx_info, int op_type, int pruning_type, PRUNING_CONTEXT *pcontext, int *removed_count)
#define DB_DEFAULT_PRECISION
STATIC_INLINE void perfmon_inc_stat(THREAD_ENTRY *thread_p, PERF_STAT_ID psid) __attribute__((ALWAYS_INLINE))
#define PCOL_ISCYCLE_TUPLE_OFFSET
HEAP_SCANCACHE m_scancache
void qfile_close_scan(THREAD_ENTRY *thread_p, QFILE_LIST_SCAN_ID *scan_id_p)
SCAN_CODE heap_get_class_oid(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid)
aggregate_hash_key * curr_part_key
bool clear_value2_at_clone_decache
void qfile_free_list_id(QFILE_LIST_ID *list_id_p)
#define LOG_FIND_THREAD_TRAN_INDEX(thrd)
#define TP_TYPE_HAS_COLLATION(typeid)
static int qexec_execute_build_columns(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
#define HFID_IS_NULL(hfid)
int catalog_get_last_representation_id(THREAD_ENTRY *thread_p, OID *class_oid_p, REPR_ID *repr_id_p)
SCAN_CODE locator_get_object(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, SCAN_OPERATION_TYPE op_type, LOCK lock_mode, int ispeeking, int chn)
char * or_class_name(RECDES *record)
bool db_value_is_null(const DB_VALUE *value)
#define ACCESS_SPEC_XASL_NODE(ptr)
bool qfile_is_sort_list_covered(SORT_LIST *covering_list_p, SORT_LIST *covered_list_p)
#define TSC_ADD_TIMEVAL(total, diff)
#define XASL_INSTNUM_FLAG_SCAN_CONTINUE
static REGU_VARIABLE * replace_null_dbval(REGU_VARIABLE *regu_var, DB_VALUE *set_dbval)
analytic_function_info info
void set_update_reevaluation(mvcc_update_reev_data &urd)
QFILE_TUPLE_RECORD * tplrecp
static DB_LOGICAL qexec_eval_grbynum_pred(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate)
static int qexec_create_mvcc_reev_assignments(THREAD_ENTRY *thread_p, XASL_NODE *aptr, bool should_delete, UPDDEL_CLASS_INFO_INTERNAL *classes, int num_classes, int num_assignments, UPDATE_ASSIGNMENT *assignments, UPDATE_MVCC_REEV_ASSIGNMENT **mvcc_reev_assigns)
void er_print_callstack(const char *file_name, const int line_no, const char *fmt,...)
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
VAL_LIST * outer_val_list
const int REGU_VARIABLE_STRICT_TYPE_CAST
OID * db_get_oid(const DB_VALUE *value)
int valcnv_convert_value_to_string(DB_VALUE *value)
const char * default_expr_format
cubxasl::aggregate_accumulator * accumulators
#define OR_MINIMUM_STRING_LENGTH_FOR_COMPRESSION
OUTPTR_LIST * prior_outptr_list
regu_variable_node * key2
QFILE_TUPLE_RECORD * tplrec2
void REGU_VARIABLE_CLEAR_FLAG(regu_variable_node *regu, int flag)
static int qexec_for_update_set_class_locks(THREAD_ENTRY *thread_p, XASL_NODE *scan_list)
qfile_list_id * qexec_execute_query(THREAD_ENTRY *thread_p, xasl_node *xasl, int dbval_cnt, const DB_VALUE *dbval_ptr, QUERY_ID query_id)
#define BTREE_IS_MULTI_ROW_OP(op)
MVCC_SNAPSHOT * mvcc_snapshot
unsigned int mht_count(const MHT_TABLE *ht)
OUTPTR_LIST * g_outptr_list
static void qexec_end_connect_by_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
SCAN_CODE(* XSAL_SCAN_FUNC)(THREAD_ENTRY *thread_p, XASL_NODE *, XASL_STATE *, QFILE_TUPLE_RECORD *, void *)
static QPROC_TPLDESCR_STATUS qexec_generate_tuple_descriptor(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id, VALPTR_LIST *outptr_list, VAL_DESCR *vd)
#define ACCESS_SPEC_LIST_ID(ptr)
regu_variable_node * elemset
static int qexec_open_scan(THREAD_ENTRY *thread_p, ACCESS_SPEC_TYPE *curr_spec, VAL_LIST *val_list, VAL_DESCR *vd, bool force_select_lock, int fixed, int grouped, bool iscan_oid_order, SCAN_ID *s_id, QUERY_ID query_id, SCAN_OPERATION_TYPE scan_op_type, bool scan_immediately_stop, bool *p_mvcc_select_lock_needed)
const char * get_db_user() const
int curr_sort_key_tuple_count
#define ER_ARG_OUT_OF_RANGE
int qfile_fast_val_tuple_to_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, DB_VALUE *val)
void thread_dec_recursion_depth(cubthread::entry *thread_p)
#define free_and_init(ptr)
SORT_LIST * after_groupby_list
#define DB_ALIGN(offset, align)
ACCESS_SPEC_TYPE * spec_list
#define BTID_COPY(btid_ptr1, btid_ptr2)
int db_datetime_encode(DB_DATETIME *datetime, int month, int day, int year, int hour, int minute, int second, int millisecond)
int or_get_attrname(RECDES *record, int attrid, char **string, int *alloced_string)
char * prm_get_string_value(PARAM_ID prm_id)
DB_ENUM_ELEMENT * elements
#define XASL_IS_MERGE_QUERY
static BH_CMP_RESULT qexec_topn_compare(const void *left, const void *right, BH_CMP_ARG arg)
DB_TIMESTAMP sys_epochtime
const char * tz_get_system_timezone(void)
OUTPTR_LIST * a_outptr_list
#define XASL_INSTNUM_FLAG_SCAN_STOP
int mvcc_reev_extra_cls_cnt
int scan_open_index_node_info_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, val_list_node *val_list, VAL_DESCR *vd, indx_info *indx_info, PRED_EXPR *pr, DB_VALUE **node_info_values, regu_variable_list_node *node_info_regu_list)
#define GOTO_EXIT_ON_ERROR
#define QFILE_GET_OVERFLOW_VPID(des, ptr)
static int qexec_upddel_setup_current_class(THREAD_ENTRY *thread_p, UPDDEL_CLASS_INFO *class_, UPDDEL_CLASS_INFO_INTERNAL *class_info, int op_type, OID *current_oid)
#define QFILE_IS_LIST_CACHE_DISABLED
#define ER_HEAP_UNKNOWN_OBJECT
static int qexec_groupby_index(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
int qfile_copy_tuple_descr_to_tuple(THREAD_ENTRY *thread_p, QFILE_TUPLE_DESCRIPTOR *tpl_descr, QFILE_TUPLE_RECORD *tplrec)
QFILE_LIST_ID * input_list_id
REGU_VARIABLE_LIST g_hk_scan_regu_list
char * qmgr_get_query_sql_user_text(THREAD_ENTRY *thread_p, QUERY_ID query_id, int tran_index)
#define QEXEC_MERGE_NEXT_SCAN(thread_p, pre, e)
#define QEXEC_SEL_UPD_USE_REEVALUATION(xasl)
#define CTE_CURRENT_SCAN_READ_TUPLE(node)
int lang_set_flag_from_lang(const char *lang_str, bool has_user_format, bool has_user_lang, int *flag)
QFILE_TUPLE_RECORD group_tplrec
bool prm_get_bool_value(PARAM_ID prm_id)
static SORT_STATUS qexec_hash_gby_get_next(THREAD_ENTRY *thread_p, RECDES *recdes, void *arg)
#define QPROC_ANALYTIC_IS_OFFSET_FUNCTION(func_p)
BINARY_HEAP * bh_create(THREAD_ENTRY *thread_p, int max_capacity, int elem_size, bh_key_comparator cmp_func, BH_CMP_ARG cmp_arg)
OUTPTR_LIST * cls_output_val_list
static int qexec_process_partition_unique_stats(THREAD_ENTRY *thread_p, PRUNING_CONTEXT *pcontext)
JSON_VALIDATOR * json_validator
aggregate_hash_key * temp_part_key
class regu_variable_node REGU_VARIABLE
int qfile_copy_list_id(QFILE_LIST_ID *dest_list_id_p, const QFILE_LIST_ID *src_list_id_p, bool is_include_sort_list)
int catalog_get_cardinality(THREAD_ENTRY *thread_p, OID *class_oid, DISK_REPR *rep, BTID *btid, const int key_pos, int *cardinality)
int db_get_string_size(const DB_VALUE *value)
REGU_VARIABLE_LIST g_hk_sort_regu_list
union scan_id_struct::@153 s
int locator_delete_lob_force(THREAD_ENTRY *thread_p, OID *class_oid, OID *oid, RECDES *recdes)
#define QFILE_PUT_NEXT_VPID_NULL(ptr)
UPDATE_ASSIGNMENT * assignments
struct drand48_data * qmgr_get_rand_buf(THREAD_ENTRY *thread_p)
#define SAFE_COPY_OID(dest_oid_ptr, src_oid_ptr)
REGU_VARIABLE_LIST cls_regu_list_pred
static int qexec_execute_selupd_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
cubxasl::aggregate_accumulator_domain ** accumulator_domains
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
#define SINGLE_ROW_INSERT
const char * tz_get_session_local_timezone(void)
void log_sysop_commit(THREAD_ENTRY *thread_p)
static int prepare_mvcc_reev_data(THREAD_ENTRY *thread_p, XASL_NODE *aptr, XASL_STATE *xasl_state, int num_reev_classes, int *cond_reev_indexes, MVCC_UPDDEL_REEV_DATA *reev_data, int num_classes, UPDDEL_CLASS_INFO *classes, UPDDEL_CLASS_INFO_INTERNAL *internal_classes, int num_assigns, UPDATE_ASSIGNMENT *assigns, PRED_EXPR *cons_pred, UPDDEL_MVCC_COND_REEVAL **mvcc_reev_classes, UPDATE_MVCC_REEV_ASSIGNMENT **mvcc_reev_assigns, bool has_delete)
int scan_start_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id)
#define TP_FLOATING_PRECISION_VALUE
static DB_VALUE_COMPARE_RESULT bf2df_str_compare(const unsigned char *s0, int l0, const unsigned char *s1, int l1)
static void qexec_clear_analytic_function_state(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state)
static int qexec_execute_selupd_list_find_class(THREAD_ENTRY *thread_p, XASL_NODE *xasl, VAL_DESCR *vd, OID *oid, SELUPD_LIST *selupd, OID *class_oid, HFID *class_hfid, DB_CLASS_PARTITION_TYPE *needs_pruning, bool *found)
#define ER_INVALID_DATA_FOR_PARTITION
upddel_mvcc_cond_reeval ** curr_extra_assign_reev
OR_DEFAULT_VALUE current_default_value
QFILE_LIST_ID * qfile_open_list(THREAD_ENTRY *thread_p, QFILE_TUPLE_VALUE_TYPE_LIST *type_list_p, SORT_LIST *sort_list_p, QUERY_ID query_id, int flag)
#define DB_VALUE_TYPE(value)
#define CHECK_MODIFICATION_NO_RETURN(error)
const container_type & get_map() const
QFILE_LIST_SCAN_ID * s_id
#define XASL_INSTNUM_FLAG_EVAL_DEFER
int db_to_char(const DB_VALUE *src_value, const DB_VALUE *format_or_length, const DB_VALUE *lang_str, DB_VALUE *result_str, const TP_DOMAIN *domain)
int db_make_null(DB_VALUE *value)
EH_SEARCH ehash_search(THREAD_ENTRY *thread_p, EHID *ehid_p, void *key_p, OID *value_p)
static void qexec_clear_head_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl_list)
void qfile_close_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p)
static int qexec_clear_regu_var(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, REGU_VARIABLE *regu_var, bool is_final)
bool oid_check_cached_class_oid(const int cache_id, const OID *oid)
#define QEXEC_MERGE_ADD_MERGETUPLE(thread_p, t1, t2)
int partition_prune_spec(THREAD_ENTRY *thread_p, val_descr *vd, access_spec_node *spec)
#define DB_IS_NULL(value)
#define PCOL_LEVEL_TUPLE_OFFSET
REGU_VARIABLE_LIST cls_regu_list_rest
HEAP_SCANCACHE * scan_cache
static DEL_LOB_INFO * qexec_change_delete_lob_info(THREAD_ENTRY *thread_p, XASL_STATE *xasl_state, UPDDEL_CLASS_INFO_INTERNAL *class_info, DEL_LOB_INFO **del_lob_info_list_ptr)
int qfile_unify_types(QFILE_LIST_ID *list_id1_p, const QFILE_LIST_ID *list_id2_p)
static int qexec_oid_of_duplicate_key_update(THREAD_ENTRY *thread_p, HEAP_SCANCACHE **pruned_partition_scan_cache, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info, HEAP_CACHE_ATTRINFO *index_attr_info, const HEAP_IDX_ELEMENTS_INFO *idx_info, int needs_pruning, PRUNING_CONTEXT *pcontext, OID *unique_oid, int op_type)
static SCAN_CODE qexec_execute_scan(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *ignore, XASL_SCAN_FNC_PTR next_scan_fnc)
int qexec_clear_pred_context(THREAD_ENTRY *thread_p, pred_expr_with_context *pred_filter, bool dealloc_dbvalues)
REGU_VARIABLE_LIST prior_regu_list_rest
qfile_list_id * qexec_get_xasl_list_id(xasl_node *xasl)
REGU_VARIABLE_LIST a_regu_list
#define ER_LK_OBJECT_DL_TIMEOUT_CLASSOF_MSG
int db_make_double(DB_VALUE *value, const DB_C_DOUBLE num)
static int qexec_end_mainblock_iterations(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
VAL_LIST * merge_val_list
static int qexec_clear_agg_orderby_const_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl, bool is_final)
LK_COMPOSITE_LOCK * composite_lock
TP_DOMAIN * tp_domain_resolve(DB_TYPE domain_type, DB_OBJECT *class_obj, int precision, int scale, TP_DOMAIN *setdomain, int collation)
#define ER_ARG_CAN_NOT_BE_CASTED_TO_DESIRED_DOMAIN
bool qdata_copy_db_value(DB_VALUE *dest_p, const DB_VALUE *src_p)
char * strdup(const char *str)
heap_cache_attrinfo * attr_cache
DB_VALUE ** node_info_values
const int REGU_VARIABLE_FETCH_ALL_CONST
REGU_VARIABLE_LIST cls_regu_list_range
analytic_list_node * next
int qdata_apply_interpolation_function_coercion(DB_VALUE *f_value, tp_domain **result_dom, DB_VALUE *result, FUNC_TYPE function)
REGU_VARIABLE_LIST arg_list
int session_begin_insert_values(THREAD_ENTRY *thread_p)
DB_TYPE original_opr_dbtype
#define XASL_ORDBYNUM_FLAG_SCAN_CONTINUE
static int qexec_end_one_iteration(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
int db_make_timestamp(DB_VALUE *value, const DB_C_TIMESTAMP timeval)
int db_make_int(DB_VALUE *value, const int num)
void heap_attrinfo_end(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info)
int qdata_tuple_to_values_array(THREAD_ENTRY *thread_p, qfile_tuple_descriptor *tuple, DB_VALUE **values)
OR_INDEX_STATUS index_status
void qdata_load_agg_hvalue_in_agg_list(aggregate_hash_value *value, cubxasl::aggregate_list_node *agg_list, bool copy_vals)
int heap_init_func_pred_unpack_info(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, const OID *class_oid, FUNC_PRED_UNPACK_INFO **func_indx_preds)
#define ER_CTE_MAX_RECURSION_REACHED
static int qexec_clear_analytic_function_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, ANALYTIC_EVAL_TYPE *list, bool is_final)
static int qexec_clear_regu_value_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, REGU_VALUE_LIST *list, bool is_final)
int db_make_oid(DB_VALUE *value, const OID *oid)
static int qexec_upddel_add_unique_oid_to_ehid(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
int qdata_free_agg_hentry(const void *key, void *data, void *args)
REGU_VARIABLE * limit_offset
SCAN_CODE scan_next_scan(THREAD_ENTRY *thread_p, SCAN_ID *s_id)
regu_variable_node * pattern
union cubxasl::eval_term::@184 et
QFILE_LIST_ID * start_with_list_id
void thread_inc_recursion_depth(cubthread::entry *thread_p)
bool log_does_allow_replication(void)
#define TP_DOMAIN_CODESET(dom)
int qdata_save_agg_htable_to_list(cubthread::entry *thread_p, mht_table *hash_table, qfile_list_id *tuple_list_id, qfile_list_id *partial_list_id, db_value *temp_dbval_array)
int qdata_copy_db_value_to_tuple_value(DB_VALUE *dbval_p, bool clear_compressed_string, char *tuple_val_p, int *tuple_val_size)
static int qexec_set_class_locks(THREAD_ENTRY *thread_p, XASL_NODE *aptr_list, UPDDEL_CLASS_INFO *query_classes, int query_classes_count, UPDDEL_CLASS_INFO_INTERNAL *internal_classes)
static void qexec_reset_regu_variable(REGU_VARIABLE *var)
#define XASL_ZERO_CORR_LEVEL
int qexec_clear_func_pred(THREAD_ENTRY *thread_p, func_pred *fpr)
int heap_get_indexinfo_of_btid(THREAD_ENTRY *thread_p, const OID *class_oid, const BTID *btid, BTREE_TYPE *type, int *num_attrs, ATTR_ID **attr_ids, int **attrs_prefix_length, char **btnamepp, int *func_index_col_id)
static int qexec_analytic_evaluate_cume_dist_percent_rank_function(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state)
#define ER_QPROC_INVALID_DATATYPE
int lock_finalize_composite_lock(THREAD_ENTRY *thread_p, LK_COMPOSITE_LOCK *comp_lock)
int qdata_initialize_aggregate_list(cubthread::entry *thread_p, cubxasl::aggregate_list_node *agg_list_p, QUERY_ID query_id)
regu_variable_node * pattern
int heap_attrinfo_set(const OID *inst_oid, ATTR_ID attrid, DB_VALUE *attr_val, HEAP_CACHE_ATTRINFO *attr_info)
static void qexec_gby_start_group_dim(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate, const RECDES *recdes)
REGU_VARIABLE_LIST g_regu_list
QPROC_SINGLE_FETCH single_fetch
OR_ATTRIBUTE * attributes
PRED_EXPR * g_having_pred
REGU_VARIABLE_LIST g_scan_regu_list
ACCESS_SPEC_TYPE * outer_spec_list
aggregate_percentile_info percentile
QFILE_TUPLE_POSITION tpl_pos
static int qexec_analytic_group_header_next(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state)
QFILE_LIST_SCAN_ID * input_scan
static int qexec_update_connect_by_lists(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, QFILE_TUPLE_RECORD *tplrec)
static int qexec_analytic_value_lookup(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state, int position, bool ignore_nulls)
#define db_private_realloc(thrd, ptr, size)
bool clear_value_at_clone_decache
HEAP_CACHE_ATTRINFO * cache_key
regu_variable_node * esc_char
#define ER_LK_OBJECT_TIMEOUT_CLASSOF_MSG
static void qexec_free_delete_lob_info_list(THREAD_ENTRY *thread_p, DEL_LOB_INFO **del_lob_info_list_ptr)
LOG_TRAN_BTID_UNIQUE_STATS * logtb_tran_find_btid_stats(THREAD_ENTRY *thread_p, const BTID *btid, bool create)
int SORT_CMP_FUNC(const void *, const void *, void *)
#define ER_QPROC_INVALID_QRY_SINGLE_TUPLE
#define QFILE_PUT_TUPLE_LENGTH(tpl, val)
VAL_LIST * inner_val_list
static int qexec_execute_mainblock_internal(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, UPDDEL_CLASS_INSTANCE_LOCK_INFO *p_class_instance_lock_info)
#define VPID_SET_NULL(vpid_ptr)
static void qexec_gby_start_group(THREAD_ENTRY *thread_p, GROUPBY_STATE *gbstate, const RECDES *recdes, int N)
#define QEXEC_MERGE_REV_SCAN_PVALS(thread_p, pre)
heap_cache_attrinfo * curr_attrinfo
static int qexec_analytic_evaluate_offset_function(THREAD_ENTRY *thread_p, ANALYTIC_FUNCTION_STATE *func_state, ANALYTIC_STATE *analytic_state)
upddel_mvcc_cond_reeval * curr_upddel
#define XASL_INSTNUM_FLAG_SCAN_CHECK
int curr_group_tuple_count
DB_DEFAULT_EXPR default_expr
bool btree_is_unique_type(BTREE_TYPE type)
int db_make_bit(DB_VALUE *value, const int bit_length, DB_CONST_C_BIT bit_str, const int bit_str_bit_size)
int qfile_fast_intint_tuple_to_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, int v1, int v2)
static SCAN_CODE qexec_next_scan_block_iterations(THREAD_ENTRY *thread_p, XASL_NODE *xasl)
REGU_VARIABLE_LIST valptrp
static int qexec_evaluate_aggregates_optimize(THREAD_ENTRY *thread_p, AGGREGATE_TYPE *agg_list, ACCESS_SPEC_TYPE *spec, bool *is_scan_needed)
static void qexec_update_btree_unique_stats_info(THREAD_ENTRY *thread_p, multi_index_unique_stats *info, const HEAP_SCANCACHE *scan_cache)
#define HFID_COPY(hfid_ptr1, hfid_ptr2)
int scan_open_heap_scan(THREAD_ENTRY *thread_p, SCAN_ID *scan_id, bool mvcc_select_lock_needed, SCAN_OPERATION_TYPE scan_op_type, int fixed, int grouped, QPROC_SINGLE_FETCH single_fetch, DB_VALUE *join_dbval, val_list_node *val_list, VAL_DESCR *vd, OID *cls_oid, HFID *hfid, regu_variable_list_node *regu_list_pred, PRED_EXPR *pr, regu_variable_list_node *regu_list_rest, int num_attrs_pred, ATTR_ID *attrids_pred, HEAP_CACHE_ATTRINFO *cache_pred, int num_attrs_rest, ATTR_ID *attrids_rest, HEAP_CACHE_ATTRINFO *cache_rest, SCAN_TYPE scan_type, DB_VALUE **cache_recordinfo, regu_variable_list_node *regu_list_recordinfo)
QFILE_LIST_ID * group_list_id
bool lock_is_instant_lock_mode(int tran_index)
static TOPN_STATUS qexec_add_tuple_to_topn(THREAD_ENTRY *thread_p, TOPN_TUPLES *sort_stop, QFILE_TUPLE_DESCRIPTOR *tpldescr)
SORT_LIST * after_iscan_list
regu_variable_list_node * node_info_regu_list
static int qexec_check_limit_clause(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state, bool *empty_result)
#define qmgr_free_old_page_and_init(thread_p, page_p, tfile_vfidp)
QFILE_LIST_MERGE_INFO * merge_info
#define catalog_free_representation_and_init(repr_p)
DB_CONST_C_CHAR db_get_string(const DB_VALUE *value)
#define XASL_IGNORE_CYCLES
REGU_VARIABLE * isleaf_regu
const char * fcode_get_uppercase_name(FUNC_TYPE ftype)
REGU_VARIABLE_LIST cls_regu_list_reserved
static int qexec_init_upddel_ehash_files(THREAD_ENTRY *thread_p, XASL_NODE *buildlist)
XASL_NODE * non_recursive_part
int qfile_clear_list_cache(THREAD_ENTRY *thread_p, int list_ht_no)
void lock_clear_deadlock_victim(int tran_index)
static int qexec_clear_agg_list(THREAD_ENTRY *thread_p, XASL_NODE *xasl_p, AGGREGATE_TYPE *list, bool is_final)
regu_variable_list_node * operands
int qfile_compare_partial_sort_record(const void *pk0, const void *pk1, void *arg)
HEAP_SCANCACHE scan_cache
int heap_set_autoincrement_value(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, HEAP_SCANCACHE *scan_cache, int *is_set)
void heap_free_func_pred_unpack_info(THREAD_ENTRY *thread_p, int n_indexes, FUNC_PRED_UNPACK_INFO *func_indx_preds, int *attr_info_started)
#define ER_LK_OBJECT_DL_TIMEOUT_SIMPLE_MSG
static int qexec_execute_build_indexes(THREAD_ENTRY *thread_p, XASL_NODE *xasl, XASL_STATE *xasl_state)
#define QPROC_MAX_GROUPED_SCAN_CNT
static DB_VALUE_COMPARE_RESULT bf2df_str_cmpval(DB_VALUE *value1, DB_VALUE *value2, int do_coercion, int total_order, int *start_colp, int collation)
#define BTREE_SET_UNIQUE_VIOLATION_ERROR(THREAD, KEY, OID, C_OID, BTID, BTNM)
#define XASL_RETURN_GENERATED_KEYS
#define ER_MVCC_NOT_SATISFIED_REEVALUATION
void logtb_complete_sub_mvcc(THREAD_ENTRY *thread_p, LOG_TDES *tdes)
int tp_domain_memory_size(TP_DOMAIN *domain)
#define QEXEC_MERGE_OUTER_NEXT_SCAN(thread_p, pre, e)
int db_value_domain_init(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale)
#define ER_MERGE_TOO_MANY_SOURCE_ROWS
#define TP_DOMAIN_COLLATION_FLAG(dom)
aggregate_hash_key * temp_key
regu_variable_node * case_sensitive
void clear(cub_regex_object *®ex, char *&pattern)
FILE * port_open_memstream(char **ptr, size_t *sizeloc)
int qdata_interpolation_function_values(DB_VALUE *f_value, DB_VALUE *c_value, double row_num_d, double f_row_num_d, double c_row_num_d, tp_domain **result_dom, DB_VALUE *result, FUNC_TYPE function)
enum analytic_stage ANALYTIC_STAGE
int qfile_add_tuple_to_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, QFILE_TUPLE tuple)
regu_variable_node * key_limit_l
int qfile_add_tuple_get_pos_in_list(THREAD_ENTRY *thread_p, QFILE_LIST_ID *list_id_p, QFILE_TUPLE tuple, QFILE_TUPLE_POSITION *tuple_pos)
SCAN_CODE heap_get_class_record(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *recdes_p, HEAP_SCANCACHE *scan_cache, int ispeeking)
#define QEXEC_GET_BH_TOPN_TUPLE(heap, index)
DISK_REPR * catalog_get_representation(THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID repr_id, CATALOG_ACCESS_INFO *catalog_access_info_p)