CUBRID Engine
latest
|
#include "query_aggregate.hpp"
#include "arithmetic.h"
#include "btree.h"
#include "db_json.hpp"
#include "dbtype.h"
#include "fetch.h"
#include "list_file.h"
#include "memory_alloc.h"
#include "memory_hash.h"
#include "object_domain.h"
#include "object_primitive.h"
#include "object_representation.h"
#include "query_opfunc.h"
#include "regu_var.hpp"
#include "string_opfunc.h"
#include "xasl.h"
#include "xasl_aggregate.hpp"
#include <cmath>
Go to the source code of this file.
DB_VALUE_COMPARE_RESULT qdata_agg_hkey_compare | ( | aggregate_hash_key * | ckey1, |
aggregate_hash_key * | ckey2, | ||
int * | diff_pos | ||
) |
Definition at line 2212 of file query_aggregate.cpp.
References assert, DB_EQ, DB_UNK, i, tp_value_compare(), cubquery::aggregate_hash_key::val_count, and cubquery::aggregate_hash_key::values.
Referenced by qdata_agg_hkey_eq(), and qexec_locate_agg_hentry_in_list().
Definition at line 2254 of file query_aggregate.cpp.
References DB_EQ, and qdata_agg_hkey_compare().
Referenced by qexec_alloc_agg_hash_context(), and qexec_hash_gby_put_next().
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 | ||
) |
Definition at line 206 of file query_aggregate.cpp.
References ARG_FILE_LINE, cubxasl::aggregate_accumulator::curr_cnt, DB_DEFAULT_PRECISION, DB_DEFAULT_SCALE, db_evaluate_json_merge_preserve(), DB_TYPE_DOUBLE, db_value_domain_init(), ER_ERROR_SEVERITY, ER_FAILED, ER_QPROC_INVALID_XASLNODE, er_set(), error(), NO_ERROR, pr_clear_value(), PT_AGG_BIT_AND, PT_AGG_BIT_OR, PT_AGG_BIT_XOR, PT_AVG, PT_COUNT, PT_COUNT_STAR, PT_GROUPBY_NUM, PT_JSON_ARRAYAGG, PT_JSON_OBJECTAGG, PT_MAX, PT_MIN, PT_STDDEV, PT_STDDEV_POP, PT_STDDEV_SAMP, PT_SUM, PT_VAR_POP, PT_VAR_SAMP, PT_VARIANCE, qdata_add_dbval(), qdata_aggregate_value_to_accumulator(), pr_type::setval(), tp_domain_resolve_default(), tp_domain::type, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qexec_gby_put_next(), and qexec_hash_gby_put_next().
|
static |
Definition at line 2892 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, assert, cubxasl::aggregate_percentile_info::cur_group_percentile, cubxasl::aggregate_list_node::domain, qfile_tuple_value_type_list::domp, error(), cubxasl::aggregate_list_node::function, cubxasl::aggregate_list_node::info, qfile_list_scan_id::list_id, NO_ERROR, NULL, cubxasl::aggregate_list_node::opr_dbtype, cubxasl::aggregate_specific_function_info::percentile, PT_MEDIAN, PT_PERCENTILE_DISC, qdata_get_interpolation_function_result(), QPROC_IS_INTERPOLATION_FUNC, S_OPENED, qfile_list_scan_id::status, TP_DOMAIN_TYPE, qfile_list_id::tuple_cnt, qfile_list_id::type_list, and cubxasl::aggregate_accumulator::value.
Referenced by qdata_finalize_aggregate_list().
|
static |
Definition at line 545 of file query_aggregate.cpp.
References ARG_FILE_LINE, db_accumulate_json_objectagg(), DB_IS_NULL, ER_ERROR_SEVERITY, ER_FAILED, ER_QPROC_INVALID_XASLNODE, er_set(), NO_ERROR, PT_JSON_OBJECTAGG, qdata_aggregate_value_to_accumulator(), and cubxasl::aggregate_accumulator::value.
Referenced by qdata_evaluate_aggregate_list().
|
static |
Definition at line 311 of file query_aggregate.cpp.
References ARG_FILE_LINE, cubxasl::aggregate_accumulator::curr_cnt, db_accumulate_json_arrayagg(), db_get_int(), DB_IS_NULL, db_make_bigint(), db_make_int(), db_value_coerce(), DB_VALUE_DOMAIN_TYPE, DOMAIN_COMPATIBLE, ER_ERROR_SEVERITY, ER_FAILED, ER_QPROC_INVALID_XASLNODE, er_set(), error(), NO_ERROR, NULL, pr_clear_value(), pr_clone_value(), PT_AGG_BIT_AND, PT_AGG_BIT_OR, PT_AGG_BIT_XOR, PT_AVG, PT_COUNT, PT_JSON_ARRAYAGG, PT_MAX, PT_MIN, PT_STDDEV, PT_STDDEV_POP, PT_STDDEV_SAMP, PT_SUM, PT_VAR_POP, PT_VAR_SAMP, PT_VARIANCE, qdata_add_dbval(), qdata_bit_and_dbval(), qdata_bit_or_dbval(), qdata_bit_xor_dbval(), qdata_multiply_dbval(), TP_DOMAIN_TYPE, tp_value_coerce(), cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qdata_aggregate_accumulator_to_accumulator(), and qdata_aggregate_multiple_values_to_accumulator().
aggregate_hash_key* qdata_alloc_agg_hkey | ( | cubthread::entry * | thread_p, |
int | val_cnt, | ||
bool | alloc_vals | ||
) |
Definition at line 1912 of file query_aggregate.cpp.
References ARG_FILE_LINE, db_private_alloc, db_private_free, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), cubquery::aggregate_hash_key::free_values, i, NULL, pr_make_value(), cubquery::aggregate_hash_key::val_count, and cubquery::aggregate_hash_key::values.
Referenced by qdata_copy_agg_hkey(), and qexec_alloc_agg_hash_context().
aggregate_hash_value* qdata_alloc_agg_hvalue | ( | cubthread::entry * | thread_p, |
int | func_cnt, | ||
cubxasl::aggregate_list_node * | g_agg_list | ||
) |
Definition at line 1987 of file query_aggregate.cpp.
References cubquery::aggregate_hash_value::accumulators, ARG_FILE_LINE, cubxasl::aggregate_accumulator::curr_cnt, db_make_int(), db_private_alloc, db_private_free, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), cubquery::aggregate_hash_value::first_tuple, cubquery::aggregate_hash_value::func_count, cubxasl::aggregate_list_node::function, i, cubxasl::aggregate_list_node::next, NULL, pr_make_value(), PT_COUNT, PT_COUNT_STAR, PT_GROUPBY_NUM, qfile_tuple_record::size, qfile_tuple_record::tpl, cubquery::aggregate_hash_value::tuple_count, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qexec_alloc_agg_hash_context(), and qexec_hash_gby_agg_tuple().
|
static |
Definition at line 1705 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, assert, cmp, pr_type::cmpval(), cubxasl::aggregate_accumulator::curr_cnt, db_change_private_heap(), DB_EQ, DB_GT, DB_IS_NULL, DB_LT, db_private_alloc, db_private_free_and_init, DB_UNK, db_value_coerce(), DB_VALUE_DOMAIN_TYPE, ER_FAILED, fetch_peek_dbval(), cubxasl::aggregate_list_node::function, i, cubxasl::aggregate_list_node::info, regu_variable_list_node::next, sort_list::next, NO_ERROR, NULL, cubxasl::aggregate_list_node::operands, pr_type_from_id(), PT_CUME_DIST, PT_PERCENT_RANK, REGU_VARIABLE_CLEAR_AT_CLONE_DECACHE, REGU_VARIABLE_IS_FLAGED(), S_DESC, sort_list::s_nulls, S_NULLS_LAST, sort_list::s_order, cubxasl::aggregate_list_node::sort_list, TYPE_REGU_VAR_LIST, and regu_variable_list_node::value.
Referenced by qdata_evaluate_aggregate_list().
aggregate_hash_key* qdata_copy_agg_hkey | ( | cubthread::entry * | thread_p, |
aggregate_hash_key * | key | ||
) |
Definition at line 2271 of file query_aggregate.cpp.
References cubquery::aggregate_hash_key::free_values, i, NULL, pr_copy_value(), qdata_alloc_agg_hkey(), cubquery::aggregate_hash_key::val_count, and cubquery::aggregate_hash_key::values.
Referenced by qexec_hash_gby_agg_tuple().
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 | ||
) |
Definition at line 1046 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, assert, cubxasl::aggregate_list_node::btid, BTID_COPY, BTID_IS_NULL, cubquery::hierarchy_aggregate_helper::btids, cleanup(), cmp, cubquery::hierarchy_aggregate_helper::count, cubxasl::aggregate_accumulator::curr_cnt, DB_EQ, DB_GT, DB_IS_NULL, DB_LT, db_make_null(), cubxasl::aggregate_list_node::domain, ER_FAILED, error(), cubxasl::aggregate_list_node::flag_agg_optimize, cubxasl::aggregate_list_node::function, cubquery::hierarchy_aggregate_helper::hfids, i, NO_ERROR, NULL, pr_clear_value(), pr_clone_value(), PT_COUNT, PT_COUNT_STAR, PT_MAX, PT_MIN, qdata_add_dbval(), qdata_evaluate_aggregate_optimize(), tp_value_compare(), and cubxasl::aggregate_accumulator::value.
Referenced by qexec_evaluate_partition_aggregates().
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 | ||
) |
Definition at line 594 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, ARG_FILE_LINE, assert, cubxasl::aggregate_percentile_info::cur_group_percentile, cubxasl::aggregate_accumulator::curr_cnt, pr_type::data_writeval(), db_get_double(), DB_IS_NULL, db_json_allocate_doc(), db_make_json(), db_private_alloc, db_private_free_and_init, DB_TYPE_BIGINT, DB_TYPE_DATE, DB_TYPE_DATETIME, DB_TYPE_DATETIMELTZ, DB_TYPE_DATETIMETZ, DB_TYPE_DOUBLE, DB_TYPE_FLOAT, DB_TYPE_INTEGER, DB_TYPE_MONETARY, DB_TYPE_NUMERIC, DB_TYPE_SHORT, DB_TYPE_TIME, DB_TYPE_TIMESTAMP, DB_TYPE_TIMESTAMPLTZ, DB_TYPE_TIMESTAMPTZ, DB_VALUE_DOMAIN_TYPE, DB_VALUE_TYPE, db_values, cubxasl::aggregate_list_node::domain, DOMAIN_COMPATIBLE, ER_ARG_CAN_NOT_BE_CASTED_TO_DESIRED_DOMAIN, er_errid(), ER_ERROR_SEVERITY, ER_FAILED, ER_JSON_OBJECT_NAME_IS_NULL, ER_PERCENTILE_FUNC_INVALID_PERCENTILE_RANGE, ER_PERCENTILE_FUNC_PERCENTILE_CHANGED_IN_GROUP, ER_QPROC_INVALID_DATATYPE, er_set(), ER_TF_BUFFER_OVERFLOW, error(), fcode_get_uppercase_name(), fetch_copy_dbval(), fetch_peek_dbval(), cubxasl::aggregate_list_node::flag_agg_optimize, cubxasl::aggregate_list_node::function, i, cubxasl::aggregate_list_node::info, cubxasl::aggregate_list_node::list_id, cubxasl::aggregate_list_node::next, regu_variable_list_node::next, NO_ERROR, NULL, cubxasl::aggregate_list_node::operands, cubxasl::aggregate_list_node::opr_dbtype, cubxasl::aggregate_list_node::option, OR_BUF_INIT, cubxasl::aggregate_specific_function_info::percentile, cubxasl::aggregate_percentile_info::percentile_reguvar, pr_clear_value(), pr_clear_value_vector(), pr_clone_value(), pr_data_writeval_disk_size(), pr_type_from_id(), PT_COUNT_STAR, PT_CUME_DIST, PT_GROUP_CONCAT, PT_GROUPBY_NUM, PT_JSON_ARRAYAGG, PT_JSON_OBJECTAGG, PT_PERCENT_RANK, PT_PERCENTILE_CONT, PT_PERCENTILE_DISC, Q_DISTINCT, qdata_aggregate_multiple_values_to_accumulator(), qdata_calculate_aggregate_cume_dist_percent_rank(), qdata_group_concat_first_value(), qdata_group_concat_value(), qdata_update_agg_interpolation_func_value_and_domain(), qfile_add_item_to_list(), QPROC_IS_INTERPOLATION_FUNC, cubxasl::aggregate_list_node::sort_list, tp_domain_resolve_default(), tp_value_cast(), TYPE_CONSTANT, TYPE_DBVAL, cubxasl::aggregate_accumulator::value, and regu_variable_list_node::value.
Referenced by qexec_end_one_iteration(), qexec_gby_agg_tuple(), and qexec_hash_gby_agg_tuple().
int qdata_evaluate_aggregate_optimize | ( | cubthread::entry * | thread_p, |
cubxasl::aggregate_list_node * | agg_p, | ||
HFID * | hfid_p, | ||
OID * | super_oid | ||
) |
Definition at line 962 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, cubxasl::aggregate_list_node::btid, BTID_IS_NULL, btree_find_min_or_max_key(), btree_get_unique_statistics_for_count(), cubxasl::aggregate_accumulator::curr_cnt, db_make_int(), ER_FAILED, vfid::fileid, cubxasl::aggregate_list_node::flag_agg_optimize, cubxasl::aggregate_list_node::function, NO_ERROR, cubxasl::aggregate_list_node::option, PT_COUNT, PT_COUNT_STAR, PT_MAX, PT_MIN, Q_ALL, cubxasl::aggregate_accumulator::value, and hfid::vfid.
Referenced by qdata_evaluate_aggregate_hierarchy(), and qexec_evaluate_aggregates_optimize().
int qdata_finalize_aggregate_list | ( | cubthread::entry * | thread_p, |
cubxasl::aggregate_list_node * | agg_list_p, | ||
bool | keep_list_file | ||
) |
Definition at line 1180 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, ARG_FILE_LINE, assert, ASSERT_ERROR, ASSERT_ERROR_AND_SET, cubxasl::aggregate_accumulator::curr_cnt, pr_type::data_readval(), DB_DEFAULT_PRECISION, DB_DEFAULT_SCALE, db_get_double(), DB_IS_NULL, db_make_double(), db_make_int(), db_make_null(), db_private_free_and_init, db_string_fix_string_size(), DB_TYPE_DOUBLE, DB_TYPE_NUMERIC, DB_TYPE_VARIABLE, db_value_coerce(), db_value_domain_init(), DB_VALUE_DOMAIN_TYPE, qfile_tuple_value_position::dom, cubxasl::aggregate_list_node::domain, db_value::domain, DOMAIN_COMPATIBLE, qfile_tuple_value_type_list::domp, ER_ERROR_SEVERITY, ER_FAILED, ER_GENERIC_ERROR, er_has_error(), er_set(), error(), cubxasl::aggregate_list_node::flag_agg_optimize, cubxasl::aggregate_list_node::function, db_domain_info::general_info, cubxasl::aggregate_list_node::info, cubxasl::aggregate_list_node::list_id, cubxasl::aggregate_list_node::next, NO_ERROR, NULL, cubxasl::aggregate_list_node::option, or_init(), PEEK, sort_list::pos_descr, qfile_tuple_value_position::pos_no, pr_clear_value(), pr_clone_value(), pr_type_from_id(), PT_AVG, PT_COUNT, PT_COUNT_STAR, PT_CUME_DIST, PT_GROUP_CONCAT, PT_GROUPBY_NUM, PT_MAX, PT_MIN, PT_PERCENT_RANK, PT_STDDEV, PT_STDDEV_POP, PT_STDDEV_SAMP, PT_SUM, PT_VAR_POP, PT_VAR_SAMP, PT_VARIANCE, Q_DISTINCT, qdata_add_dbval(), qdata_aggregate_interpolation(), qdata_divide_dbval(), qdata_group_concat_first_value(), qdata_group_concat_value(), qdata_multiply_dbval(), qdata_subtract_dbval(), qfile_close_list(), qfile_close_scan(), qfile_destroy_list(), QFILE_GET_TUPLE_VALUE_FLAG, QFILE_GET_TUPLE_VALUE_LENGTH, qfile_open_list_scan(), qfile_scan_list_next(), qfile_sort_list(), QFILE_TUPLE_LENGTH_SIZE, QFILE_TUPLE_VALUE_HEADER_SIZE, QPROC_IS_INTERPOLATION_FUNC, S_ERROR, S_SUCCESS, pr_type::setval(), cubxasl::aggregate_list_node::sort_list, TP_DOMAIN_COLL_NORMAL, TP_DOMAIN_COLLATION_FLAG, tp_domain_resolve_default(), TP_DOMAIN_TYPE, tp_value_coerce(), qfile_tuple_record::tpl, qfile_list_id::tuple_cnt, tp_domain::type, db_domain_info::general_info::type, qfile_tuple_value_type_list::type_cnt, qfile_list_id::type_list, V_UNBOUND, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qexec_end_buildvalueblock_iterations(), and qexec_gby_finalize_group().
int qdata_free_agg_hentry | ( | const void * | key, |
void * | data, | ||
void * | args | ||
) |
Definition at line 2166 of file query_aggregate.cpp.
References NO_ERROR, qdata_free_agg_hkey(), and qdata_free_agg_hvalue().
Referenced by qdata_save_agg_htable_to_list(), qexec_free_agg_hash_context(), and qexec_hash_gby_agg_tuple().
void qdata_free_agg_hkey | ( | cubthread::entry * | thread_p, |
aggregate_hash_key * | key | ||
) |
Definition at line 1951 of file query_aggregate.cpp.
References db_private_free, cubquery::aggregate_hash_key::free_values, i, NULL, pr_free_value(), cubquery::aggregate_hash_key::val_count, and cubquery::aggregate_hash_key::values.
Referenced by qdata_free_agg_hentry(), qexec_free_agg_hash_context(), and qexec_hash_gby_agg_tuple().
void qdata_free_agg_hvalue | ( | cubthread::entry * | thread_p, |
aggregate_hash_value * | value | ||
) |
Definition at line 2060 of file query_aggregate.cpp.
References cubquery::aggregate_hash_value::accumulators, db_private_free, cubquery::aggregate_hash_value::first_tuple, cubquery::aggregate_hash_value::func_count, i, NULL, pr_free_value(), qfile_tuple_record::size, qfile_tuple_record::tpl, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qdata_free_agg_hentry(), qexec_free_agg_hash_context(), and qexec_hash_gby_agg_tuple().
int qdata_get_agg_hkey_size | ( | aggregate_hash_key * | key | ) |
Definition at line 2105 of file query_aggregate.cpp.
References i, NULL, pr_value_mem_size(), cubquery::aggregate_hash_key::val_count, and cubquery::aggregate_hash_key::values.
Referenced by qexec_hash_gby_agg_tuple().
int qdata_get_agg_hvalue_size | ( | aggregate_hash_value * | value, |
bool | ret_delta | ||
) |
Definition at line 2128 of file query_aggregate.cpp.
References cubquery::aggregate_hash_value::accumulators, cubquery::aggregate_hash_value::curr_size, cubquery::aggregate_hash_value::first_tuple, cubquery::aggregate_hash_value::func_count, i, NULL, pr_value_mem_size(), qfile_tuple_record::size, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qexec_hash_gby_agg_tuple().
|
static |
Definition at line 2755 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, ASSERT_ERROR, DB_DEFAULT_PRECISION, DB_DEFAULT_SCALE, DB_IS_NULL, db_make_null(), db_string_make_empty_typed_string(), db_value_domain_init(), DB_VALUE_DOMAIN_TYPE, cubxasl::aggregate_list_node::domain, db_value::domain, db_domain_info::general_info, db_domain_info::general_info::is_null, NO_ERROR, NULL, pr_clear_value(), pr_clone_value(), prm_get_bigint_value(), prm_get_bool_value(), PRM_ID_GROUP_CONCAT_MAX_LEN, PRM_ID_ORACLE_STYLE_EMPTY_STRING, qdata_concatenate_dbval(), TP_DOMAIN_CODESET, TP_DOMAIN_COLLATION, TP_DOMAIN_TYPE, and cubxasl::aggregate_accumulator::value.
Referenced by qdata_evaluate_aggregate_list(), and qdata_finalize_aggregate_list().
|
static |
Definition at line 2823 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, assert, DB_DEFAULT_PRECISION, DB_IS_NULL, db_make_null(), db_string_make_empty_typed_string(), DB_TYPE_BIT, DB_TYPE_VARBIT, DB_VALUE_DOMAIN_TYPE, cubxasl::aggregate_list_node::domain, db_value::domain, ER_FAILED, db_domain_info::general_info, db_domain_info::general_info::is_null, NO_ERROR, NULL, pr_clear_value(), pr_clone_value(), prm_get_bigint_value(), prm_get_bool_value(), PRM_ID_GROUP_CONCAT_MAX_LEN, PRM_ID_ORACLE_STYLE_EMPTY_STRING, qdata_concatenate_dbval(), TP_DOMAIN_CODESET, TP_DOMAIN_COLLATION, TP_DOMAIN_TYPE, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qdata_evaluate_aggregate_list(), and qdata_finalize_aggregate_list().
unsigned int qdata_hash_agg_hkey | ( | const void * | key, |
unsigned int | ht_size | ||
) |
Definition at line 2189 of file query_aggregate.cpp.
References i, mht_get_hash_number(), cubquery::aggregate_hash_key::val_count, and cubquery::aggregate_hash_key::values.
Referenced by qexec_alloc_agg_hash_context().
int qdata_initialize_aggregate_list | ( | cubthread::entry * | thread_p, |
cubxasl::aggregate_list_node * | agg_list_p, | ||
QUERY_ID | query_id | ||
) |
Definition at line 135 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, cubxasl::aggregate_accumulator::curr_cnt, DB_DEFAULT_PRECISION, DB_DEFAULT_SCALE, db_make_int(), db_value_domain_init(), DB_VALUE_DOMAIN_TYPE, ER_FAILED, cubxasl::aggregate_list_node::function, cubxasl::aggregate_list_node::info, cubxasl::aggregate_list_node::next, NO_ERROR, NULL, cubxasl::aggregate_list_node::option, PT_COUNT, PT_COUNT_STAR, PT_CUME_DIST, PT_GROUPBY_NUM, PT_PERCENT_RANK, Q_DISTINCT, qdata_process_distinct_or_sort(), cubxasl::aggregate_list_node::sort_list, and cubxasl::aggregate_accumulator::value.
Referenced by qexec_gby_start_group(), and qexec_start_mainblock_iterations().
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 | ||
) |
Definition at line 2593 of file query_aggregate.cpp.
References NO_ERROR, PEEK, qdata_load_agg_hentry_from_tuple(), qfile_scan_list_next(), S_ERROR, S_SUCCESS, and qfile_tuple_record::tpl.
Referenced by qexec_groupby(), and qexec_locate_agg_hentry_in_list().
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 | ||
) |
Definition at line 2464 of file query_aggregate.cpp.
References cubquery::aggregate_hash_value::accumulators, cubxasl::aggregate_accumulator::curr_cnt, db_value::data, pr_type::data_readval(), db_make_int(), db_make_null(), ER_FAILED, cubquery::aggregate_hash_value::func_count, i, db_data::i, NO_ERROR, NULL, or_advance(), OR_BUF_INIT, pr_clear_value(), QFILE_GET_TUPLE_LENGTH, qfile_locate_tuple_next_value(), QFILE_TUPLE_LENGTH_SIZE, rc, tp_Integer_domain, cubquery::aggregate_hash_value::tuple_count, tp_domain::type, V_BOUND, cubquery::aggregate_hash_key::val_count, cubxasl::aggregate_accumulator::value, cubxasl::aggregate_accumulator::value2, and cubquery::aggregate_hash_key::values.
Referenced by qdata_load_agg_hentry_from_list(), and qexec_hash_gby_put_next().
void qdata_load_agg_hvalue_in_agg_list | ( | aggregate_hash_value * | value, |
cubxasl::aggregate_list_node * | agg_list, | ||
bool | copy_vals | ||
) |
Definition at line 2304 of file query_aggregate.cpp.
References cubxasl::aggregate_list_node::accumulator, cubquery::aggregate_hash_value::accumulators, assert, db_data::ch, db_char::compressed_need_clear, cubxasl::aggregate_accumulator::curr_cnt, db_value::data, DB_TYPE_VARCHAR, DB_TYPE_VARNCHAR, DB_VALUE_DOMAIN_TYPE, cubquery::aggregate_hash_value::func_count, cubxasl::aggregate_list_node::function, i, db_char::info, db_value::need_clear, cubxasl::aggregate_list_node::next, NULL, pr_clone_value(), PT_GROUPBY_NUM, cubxasl::aggregate_accumulator::value, and cubxasl::aggregate_accumulator::value2.
Referenced by qexec_gby_put_next(), and qexec_groupby().
|
static |
Definition at line 74 of file query_aggregate.cpp.
References db_private_alloc, db_private_free_and_init, qfile_tuple_value_type_list::domp, ER_FAILED, cubxasl::aggregate_list_node::function, cubxasl::aggregate_list_node::list_id, NO_ERROR, NULL, cubxasl::aggregate_list_node::operands, cubxasl::aggregate_list_node::option, PT_MAX, PT_MIN, Q_ALL, qfile_close_list(), qfile_copy_list_id(), qfile_destroy_list(), QFILE_FLAG_ALL, QFILE_FLAG_DISTINCT, QFILE_FREE_AND_INIT_LIST_ID, qfile_open_list(), cubxasl::aggregate_list_node::sort_list, qfile_tuple_value_type_list::type_cnt, and regu_variable_list_node::value.
Referenced by qdata_initialize_aggregate_list().
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 | ||
) |
Definition at line 2389 of file query_aggregate.cpp.
References cubquery::aggregate_hash_value::accumulators, cleanup(), cubxasl::aggregate_accumulator::curr_cnt, db_make_int(), db_private_free, error(), qfile_tuple_descriptor::f_valp, cubquery::aggregate_hash_value::func_count, i, NO_ERROR, NULL, qdata_get_tuple_value_size_from_dbval(), qfile_add_tuple_to_list(), qfile_copy_tuple_descr_to_tuple(), qfile_generate_tuple_into_list(), QFILE_MAX_TUPLE_SIZE_IN_PAGE, QFILE_TUPLE_LENGTH_SIZE, T_NORMAL, qfile_tuple_record::tpl, qfile_list_id::tpl_descr, qfile_tuple_descriptor::tpl_size, cubquery::aggregate_hash_value::tuple_count, cubquery::aggregate_hash_key::val_count, cubxasl::aggregate_accumulator::value, cubxasl::aggregate_accumulator::value2, and cubquery::aggregate_hash_key::values.
Referenced by qdata_save_agg_htable_to_list(), qexec_groupby(), qexec_hash_gby_agg_tuple(), and qexec_hash_gby_put_next().
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 | ||
) |
Definition at line 2624 of file query_aggregate.cpp.
References mht_table::act_head, hentry::act_next, hentry::data, ER_FAILED, cubquery::aggregate_hash_value::first_tuple, hentry::key, mht_clear(), NO_ERROR, NULL, qdata_free_agg_hentry(), qdata_save_agg_hentry_to_list(), qfile_add_tuple_to_list(), rc, qfile_tuple_record::tpl, and cubquery::aggregate_hash_value::tuple_count.
Referenced by qexec_groupby(), and qexec_hash_gby_agg_tuple().
|
static |
Definition at line 2687 of file query_aggregate.cpp.
References ARG_FILE_LINE, assert, DB_IS_NULL, DB_TYPE_DOUBLE, DB_TYPE_VARIABLE, db_value_coerce(), DB_VALUE_DOMAIN_TYPE, qfile_tuple_value_position::dom, cubxasl::aggregate_list_node::domain, qfile_tuple_value_type_list::domp, ER_ARG_CAN_NOT_BE_CASTED_TO_DESIRED_DOMAIN, ER_ERROR_SEVERITY, er_set(), error(), fcode_get_uppercase_name(), cubxasl::aggregate_list_node::function, cubxasl::aggregate_list_node::list_id, NO_ERROR, NULL, sort_list::pos_descr, PT_PERCENTILE_DISC, qdata_update_interpolation_func_value_and_domain(), QPROC_IS_INTERPOLATION_FUNC, cubxasl::aggregate_list_node::sort_list, TP_DOMAIN_COLL_NORMAL, TP_DOMAIN_COLLATION_FLAG, tp_domain_resolve_default(), TP_DOMAIN_TYPE, TP_IS_DATE_OR_TIME_TYPE, TP_IS_NUMERIC_TYPE, qfile_tuple_value_type_list::type_cnt, and qfile_list_id::type_list.
Referenced by qdata_evaluate_aggregate_list().