From 80c51d07c82db1ebcf43d2ac9510217eabbe5148 Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Tue, 23 Jul 2024 15:30:11 +0800 Subject: [PATCH 1/7] DEBUG --- be/src/runtime/fragment_mgr.cpp | 7 +++++++ .../vec/aggregate_functions/aggregate_function_histogram.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index 5389bf2b7ec862..fd9399817ebdd3 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -708,6 +708,13 @@ Status FragmentMgr::exec_plan_fragment(const TPipelineFragmentParams& params, VLOG_ROW << "query: " << print_id(params.query_id) << "query options is " << apache::thrift::ThriftDebugString(params.query_options).c_str(); +#ifndef NDEBUG + std::string str = apache::thrift::ThriftDebugString(params); + if (str.find("partial_histogram") != std::string::npos) { + LOG_INFO("Query {}, plan\n{}", print_id(params.query_id), str); + } +#endif + std::shared_ptr query_ctx; RETURN_IF_ERROR(_get_query_ctx(params, params.query_id, true, query_ctx)); SCOPED_ATTACH_TASK_WITH_ID(query_ctx->query_mem_tracker, params.query_id); diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index cae2a88daf0f75..c62748f9bdb09c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -189,7 +189,9 @@ class AggregateFunctionHistogram final if (columns[0]->is_null_at(row_num)) { return; } - +#ifndef NDEBUG + LOG_INFO("histogram has_input_param {}", has_input_param); +#endif if (has_input_param) { this->data(place).set_parameters( assert_cast(columns[1])->get_element(row_num)); From 6136a2030774e49d3399327a8965d4caf93082fa Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Thu, 25 Jul 2024 20:56:41 +0800 Subject: [PATCH 2/7] FIX --- be/src/runtime/fragment_mgr.cpp | 7 +++++++ .../aggregate_function_histogram.h | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index 5389bf2b7ec862..6530f92aa2443b 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -708,6 +708,13 @@ Status FragmentMgr::exec_plan_fragment(const TPipelineFragmentParams& params, VLOG_ROW << "query: " << print_id(params.query_id) << "query options is " << apache::thrift::ThriftDebugString(params.query_options).c_str(); +#ifndef NDEBUG + std::string str = apache::thrift::ThriftDebugString(params); + if (str.find("histogram") != std::string::npos) { + LOG_INFO("Query {}, plan\n{}", print_id(params.query_id), str); + } +#endif + std::shared_ptr query_ctx; RETURN_IF_ERROR(_get_query_ctx(params, params.query_id, true, query_ctx)); SCOPED_ATTACH_TASK_WITH_ID(query_ctx->query_mem_tracker, params.query_id); diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index cae2a88daf0f75..5cab479c113a25 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -28,6 +28,8 @@ #include #include +#include "common/exception.h" +#include "common/status.h" #include "vec/aggregate_functions/aggregate_function.h" #include "vec/aggregate_functions/aggregate_function_simple_factory.h" #include "vec/columns/column.h" @@ -61,6 +63,9 @@ struct AggregateFunctionHistogramData { void set_parameters(int input_max_num_buckets) { if (input_max_num_buckets > 0) { max_num_buckets = (size_t)input_max_num_buckets; + } else { + throw doris::Exception(ErrorCode::INVALID_ARGUMENT, "Invalid max_num_buckets {}", + input_max_num_buckets); } } @@ -190,7 +195,14 @@ class AggregateFunctionHistogram final return; } - if (has_input_param) { + if constexpr (has_input_param) { + Int32 input_max_num_buckets = + assert_cast(columns[1])->get_element(row_num); + if (input_max_num_buckets <= 0) { + throw doris::Exception(ErrorCode::INVALID_ARGUMENT, + "Invalid max_num_buckets {}, row_num {}", + input_max_num_buckets, row_num); + } this->data(place).set_parameters( assert_cast(columns[1])->get_element(row_num)); } From 45aff74f16c94ab3b7dc2f53e7ca368978c61067 Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Thu, 25 Jul 2024 21:02:10 +0800 Subject: [PATCH 3/7] NEED --- be/src/vec/aggregate_functions/aggregate_function_histogram.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index 5cab479c113a25..8a8ecfe3028fa3 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -195,7 +195,7 @@ class AggregateFunctionHistogram final return; } - if constexpr (has_input_param) { + if (has_input_param) { Int32 input_max_num_buckets = assert_cast(columns[1])->get_element(row_num); if (input_max_num_buckets <= 0) { From cfae178230bbcb5d5123ef9b4130fe5fd46ff482 Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Tue, 23 Jul 2024 15:30:11 +0800 Subject: [PATCH 4/7] DEBUG --- be/src/runtime/fragment_mgr.cpp | 7 +++++++ .../vec/aggregate_functions/aggregate_function_histogram.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index 057dca4a2ee18b..39eaf332c21f8c 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -708,6 +708,13 @@ Status FragmentMgr::exec_plan_fragment(const TPipelineFragmentParams& params, VLOG_ROW << "query: " << print_id(params.query_id) << "query options is " << apache::thrift::ThriftDebugString(params.query_options).c_str(); +#ifndef NDEBUG + std::string str = apache::thrift::ThriftDebugString(params); + if (str.find("partial_histogram") != std::string::npos) { + LOG_INFO("Query {}, plan\n{}", print_id(params.query_id), str); + } +#endif + std::shared_ptr query_ctx; RETURN_IF_ERROR(_get_query_ctx(params, params.query_id, true, query_ctx)); SCOPED_ATTACH_TASK(query_ctx.get()); diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index cae2a88daf0f75..c62748f9bdb09c 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -189,7 +189,9 @@ class AggregateFunctionHistogram final if (columns[0]->is_null_at(row_num)) { return; } - +#ifndef NDEBUG + LOG_INFO("histogram has_input_param {}", has_input_param); +#endif if (has_input_param) { this->data(place).set_parameters( assert_cast(columns[1])->get_element(row_num)); From 55aceec58d1f6d2fb0d5f974a7f37934bef616b9 Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Wed, 31 Jul 2024 17:27:26 +0800 Subject: [PATCH 5/7] FIX --- be/src/runtime/fragment_mgr.cpp | 7 -- .../aggregate_function_histogram.h | 29 ++++--- .../test_aggregate_all_functions2.out | 54 ++++++++++++ .../test_aggregate_all_functions2.groovy | 83 +++++++++++++++++++ 4 files changed, 153 insertions(+), 20 deletions(-) diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp index b2702354f3dffc..057dca4a2ee18b 100644 --- a/be/src/runtime/fragment_mgr.cpp +++ b/be/src/runtime/fragment_mgr.cpp @@ -708,13 +708,6 @@ Status FragmentMgr::exec_plan_fragment(const TPipelineFragmentParams& params, VLOG_ROW << "query: " << print_id(params.query_id) << "query options is " << apache::thrift::ThriftDebugString(params.query_options).c_str(); -#ifndef NDEBUG - std::string str = apache::thrift::ThriftDebugString(params); - if (str.find("histogram") != std::string::npos) { - LOG_INFO("Query {}, plan\n{}", print_id(params.query_id), str); - } -#endif - std::shared_ptr query_ctx; RETURN_IF_ERROR(_get_query_ctx(params, params.query_id, true, query_ctx)); SCOPED_ATTACH_TASK(query_ctx.get()); diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index e774af9ffadcd7..b45cb327e6921e 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -59,10 +59,11 @@ template struct AggregateFunctionHistogramData { using ColVecType = std::conditional_t, ColumnDecimal, ColumnVector>; + const static Int32 DEFAULT_BUCKET_NUM = 128; - void set_parameters(int input_max_num_buckets) { + void set_parameters(Int32 input_max_num_buckets) { if (input_max_num_buckets > 0) { - max_num_buckets = (size_t)input_max_num_buckets; + max_num_buckets = input_max_num_buckets; } else { throw doris::Exception(ErrorCode::INVALID_ARGUMENT, "Invalid max_num_buckets {}", input_max_num_buckets); @@ -91,7 +92,9 @@ struct AggregateFunctionHistogramData { } void merge(const AggregateFunctionHistogramData& rhs) { - if (!rhs.max_num_buckets) { + // if rhs.max_num_buckets == 1, it means the input block for serialization is all null + // we should discard this data, because histogram only fouce on the not-null data + if (!rhs.max_num_buckets || rhs.max_num_buckets == -1) { return; } @@ -109,7 +112,6 @@ struct AggregateFunctionHistogramData { void write(BufferWritable& buf) const { write_binary(max_num_buckets, buf); - size_t element_number = (size_t)ordered_map.size(); write_binary(element_number, buf); @@ -153,7 +155,12 @@ struct AggregateFunctionHistogramData { std::string get(const DataTypePtr& data_type) const { std::vector> buckets; rapidjson::StringBuffer buffer; - build_histogram(buckets, ordered_map, max_num_buckets); + // NOTE: We need an extral branch for to handle max_num_buckets == 1 + // when target column is nullable, and input block is all null, + // set_parameters will not be called because of the short-circuit in + // AggregateFunctionNullVariadicInline, so max_num_buckets will be -1 in this situation. + build_histogram(buckets, ordered_map, + max_num_buckets == -1 ? DEFAULT_BUCKET_NUM : max_num_buckets); histogram_to_json(buffer, buckets, data_type); return std::string(buffer.GetString()); } @@ -167,7 +174,7 @@ struct AggregateFunctionHistogramData { } private: - size_t max_num_buckets = 128; + Int32 max_num_buckets = -1; std::map ordered_map; }; @@ -191,13 +198,7 @@ class AggregateFunctionHistogram final void add(AggregateDataPtr __restrict place, const IColumn** columns, ssize_t row_num, Arena* arena) const override { - if (columns[0]->is_null_at(row_num)) { - return; - } -#ifndef NDEBUG - LOG_INFO("histogram has_input_param {}", has_input_param); -#endif - if (has_input_param) { + if constexpr (has_input_param) { Int32 input_max_num_buckets = assert_cast(columns[1])->get_element(row_num); if (input_max_num_buckets <= 0) { @@ -207,6 +208,8 @@ class AggregateFunctionHistogram final } this->data(place).set_parameters( assert_cast(columns[1])->get_element(row_num)); + } else { + this->data(place).set_parameters(Data::DEFAULT_BUCKET_NUM); } if constexpr (std::is_same_v) { diff --git a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out index f41a52f0ae08a7..cdf79b4abd4057 100644 --- a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out +++ b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out @@ -118,3 +118,57 @@ -- !select_minmax4 -- 243 +-- !select_histogram_k0 -- +{"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":7,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":8,"pre_sum":7}]} + +-- !select_histogram_k1 -- +{"num_buckets":1,"buckets":[{"lower":"1","upper":"15","ndv":15,"count":15,"pre_sum":0}]} + +-- !select_histogram_k2 -- +{"num_buckets":2,"buckets":[{"lower":"-32767","upper":"1985","ndv":9,"count":11,"pre_sum":0},{"lower":"1986","upper":"32767","ndv":5,"count":10,"pre_sum":11}]} + +-- !select_histogram_k3 -- +{"num_buckets":3,"buckets":[{"lower":"-2147483647","upper":"1001","ndv":3,"count":5,"pre_sum":0},{"lower":"1002","upper":"3021","ndv":2,"count":5,"pre_sum":5},{"lower":"5014","upper":"2147483647","ndv":3,"count":5,"pre_sum":10}]} + +-- !select_histogram_k4 -- +{"num_buckets":4,"buckets":[{"lower":"-9223372036854775807","upper":"123456","ndv":4,"count":5,"pre_sum":0},{"lower":"7210457","upper":"11011903","ndv":3,"count":5,"pre_sum":5},{"lower":"11011905","upper":"11011920","ndv":2,"count":3,"pre_sum":10},{"lower":"9223372036854775807","upper":"9223372036854775807","ndv":1,"count":2,"pre_sum":13}]} + +-- !select_histogram_k5 -- +{"num_buckets":5,"buckets":[{"lower":"-654.654","upper":"-0.123","ndv":3,"count":3,"pre_sum":0},{"lower":"0.000","upper":"0.666","ndv":2,"count":3,"pre_sum":3},{"lower":"3.141","upper":"123.123","ndv":3,"count":3,"pre_sum":6},{"lower":"243.325","upper":"1243.500","ndv":2,"count":3,"pre_sum":9},{"lower":"24453.325","upper":"604587.000","ndv":3,"count":3,"pre_sum":12}]} + +-- !select_histogram_k6 -- +{"num_buckets":2,"buckets":[{"lower":"false","upper":"false","ndv":1,"count":8,"pre_sum":0},{"lower":"true","upper":"true","ndv":1,"count":7,"pre_sum":8}]} + +-- !select_histogram_k7 -- +{"num_buckets":7,"buckets":[{"lower":"","upper":"du3lnvl","ndv":3,"count":3,"pre_sum":0},{"lower":"jiw3n4","upper":"lifsno","ndv":2,"count":2,"pre_sum":3},{"lower":"wangjuoo4","upper":"wangjuoo5","ndv":2,"count":3,"pre_sum":5},{"lower":"wangynnsf","upper":"wenlsfnl","ndv":2,"count":3,"pre_sum":8},{"lower":"yanavnd","upper":"yanavnd","ndv":1,"count":1,"pre_sum":11},{"lower":"yanvjldjlll","upper":"yanvjldjlll","ndv":1,"count":1,"pre_sum":12},{"lower":"yunlj8@nk","upper":"yunlj8@nk","ndv":1,"count":2,"pre_sum":13}]} + +-- !select_histogram_k8 -- +{"num_buckets":8,"buckets":[{"lower":"-123456.54","upper":"-987.001","ndv":2,"count":2,"pre_sum":0},{"lower":"-564.898","upper":"-564.898","ndv":1,"count":1,"pre_sum":2},{"lower":"0","upper":"0","ndv":1,"count":3,"pre_sum":3},{"lower":"0.1","upper":"0.1","ndv":1,"count":2,"pre_sum":6},{"lower":"2.06","upper":"3.141592653","ndv":2,"count":2,"pre_sum":8},{"lower":"3.141592654","upper":"20.268","ndv":2,"count":2,"pre_sum":10},{"lower":"123.456","upper":"78945","ndv":2,"count":2,"pre_sum":12},{"lower":"987456.123","upper":"987456.123","ndv":1,"count":1,"pre_sum":14}]} + +-- !select_histogram_k0_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k1_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k2 -- +{"num_buckets":2,"buckets":[{"lower":"10","upper":"12","ndv":3,"count":3,"pre_sum":0},{"lower":"13","upper":"15","ndv":3,"count":3,"pre_sum":3}]} + +-- !select_histogram_k3_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k4_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k5_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k6_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k7_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k8_all_null -- +{"num_buckets":0,"buckets":[]} + diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy index f119b6637dd84c..0ecab68483e1f7 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy @@ -113,4 +113,87 @@ suite("test_aggregate_all_functions2") { qt_select_minmax2 """ select max_by(datekey,hour) from metric_table; """ qt_select_minmax3 """ select bitmap_to_string(max_by(device_id,hour)) from metric_table; """ qt_select_minmax4 """ select bitmap_to_string(min_by(device_id,hour)) from metric_table; """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 13, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 14, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 15, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + qt_select_histogram_k0 """SELECT histogram(k0) FROM baseall""" + qt_select_histogram_k1 """SELECT histogram(k1, 1) FROM baseall""" + qt_select_histogram_k2 """SELECT histogram(k2, 2) FROM baseall""" + qt_select_histogram_k3 """SELECT histogram(k3, 3) FROM baseall""" + qt_select_histogram_k4 """SELECT histogram(k4, 4) FROM baseall""" + qt_select_histogram_k5 """SELECT histogram(k5, 5) FROM baseall""" + qt_select_histogram_k6 """SELECT histogram(k6, 6) FROM baseall""" + qt_select_histogram_k7 """SELECT histogram(k7, 7) FROM baseall""" + qt_select_histogram_k8 """SELECT histogram(k8, 8) FROM baseall""" + + sql """ + TRUNCATE TABLE baseall; + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 12, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 13, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 14, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + + sql """ + INSERT INTO baseall values + (NULL, NULL, 15, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) + """ + qt_select_histogram_k0_all_null """SELECT histogram(k0) FROM baseall""" + qt_select_histogram_k1_all_null """SELECT histogram(k1, 1) FROM baseall""" + qt_select_histogram_k2 """SELECT histogram(k2, 2) FROM baseall""" + qt_select_histogram_k3_all_null """SELECT histogram(k3, 3) FROM baseall""" + qt_select_histogram_k4_all_null """SELECT histogram(k4, 4) FROM baseall""" + qt_select_histogram_k5_all_null """SELECT histogram(k5, 5) FROM baseall""" + qt_select_histogram_k6_all_null """SELECT histogram(k6, 6) FROM baseall""" + qt_select_histogram_k7_all_null """SELECT histogram(k7, 7) FROM baseall""" + qt_select_histogram_k8_all_null """SELECT histogram(k8, 8) FROM baseall""" } From e1fe0e3f42eef40a6d42aa5e5148bb3990292b22 Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Thu, 1 Aug 2024 22:23:02 +0800 Subject: [PATCH 6/7] REFINE --- .../aggregate_function_histogram.h | 30 ++- .../test_aggregate_all_functions2.out | 174 ------------------ .../test_aggregate_all_functions2.groovy | 16 +- 3 files changed, 26 insertions(+), 194 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.h b/be/src/vec/aggregate_functions/aggregate_function_histogram.h index b45cb327e6921e..8fcd133b055bd3 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.h +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.h @@ -59,16 +59,10 @@ template struct AggregateFunctionHistogramData { using ColVecType = std::conditional_t, ColumnDecimal, ColumnVector>; - const static Int32 DEFAULT_BUCKET_NUM = 128; + const static size_t DEFAULT_BUCKET_NUM = 128; + const static size_t BUCKET_NUM_INIT_VALUE = 0; - void set_parameters(Int32 input_max_num_buckets) { - if (input_max_num_buckets > 0) { - max_num_buckets = input_max_num_buckets; - } else { - throw doris::Exception(ErrorCode::INVALID_ARGUMENT, "Invalid max_num_buckets {}", - input_max_num_buckets); - } - } + void set_parameters(size_t input_max_num_buckets) { max_num_buckets = input_max_num_buckets; } void reset() { ordered_map.clear(); } @@ -92,9 +86,9 @@ struct AggregateFunctionHistogramData { } void merge(const AggregateFunctionHistogramData& rhs) { - // if rhs.max_num_buckets == 1, it means the input block for serialization is all null + // if rhs.max_num_buckets == 0, it means the input block for serialization is all null // we should discard this data, because histogram only fouce on the not-null data - if (!rhs.max_num_buckets || rhs.max_num_buckets == -1) { + if (!rhs.max_num_buckets) { return; } @@ -155,12 +149,13 @@ struct AggregateFunctionHistogramData { std::string get(const DataTypePtr& data_type) const { std::vector> buckets; rapidjson::StringBuffer buffer; - // NOTE: We need an extral branch for to handle max_num_buckets == 1 + // NOTE: We need an extral branch for to handle max_num_buckets == 0, // when target column is nullable, and input block is all null, // set_parameters will not be called because of the short-circuit in - // AggregateFunctionNullVariadicInline, so max_num_buckets will be -1 in this situation. - build_histogram(buckets, ordered_map, - max_num_buckets == -1 ? DEFAULT_BUCKET_NUM : max_num_buckets); + // AggregateFunctionNullVariadicInline, so max_num_buckets will be 0 in this situation. + build_histogram( + buckets, ordered_map, + max_num_buckets == BUCKET_NUM_INIT_VALUE ? DEFAULT_BUCKET_NUM : max_num_buckets); histogram_to_json(buffer, buckets, data_type); return std::string(buffer.GetString()); } @@ -174,7 +169,7 @@ struct AggregateFunctionHistogramData { } private: - Int32 max_num_buckets = -1; + size_t max_num_buckets = BUCKET_NUM_INIT_VALUE; std::map ordered_map; }; @@ -206,8 +201,7 @@ class AggregateFunctionHistogram final "Invalid max_num_buckets {}, row_num {}", input_max_num_buckets, row_num); } - this->data(place).set_parameters( - assert_cast(columns[1])->get_element(row_num)); + this->data(place).set_parameters(input_max_num_buckets); } else { this->data(place).set_parameters(Data::DEFAULT_BUCKET_NUM); } diff --git a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out index cdf79b4abd4057..e69de29bb2d1d6 100644 --- a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out +++ b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out @@ -1,174 +0,0 @@ --- This file is automatically generated. You should know what you did if you want to edit this --- !select_approx_count_distinct1 -- -2 - --- !select_approx_count_distinct2 -- -15 - --- !select_collect_set1 -- -5 - --- !select_collect_set2 -- -5 - --- !select_collect_list1 -- -5 - --- !select_collect_list2 -- -5 - --- !select_histogram -- -{"num_buckets":5,"buckets":[{"lower":"","upper":"jiw3n4","ndv":4,"count":4,"pre_sum":0},{"lower":"lifsno","upper":"wangjuoo5","ndv":3,"count":4,"pre_sum":4},{"lower":"wangynnsf","upper":"yanavnd","ndv":3,"count":4,"pre_sum":8},{"lower":"yanvjldjlll","upper":"yanvjldjlll","ndv":1,"count":1,"pre_sum":12},{"lower":"yunlj8@nk","upper":"yunlj8@nk","ndv":1,"count":2,"pre_sum":13}]} - --- !select_max_by1 -- -15 - --- !select_max_by2 -- -8 - --- !select_max_by3 -- -3 - --- !select_min_by1 -- -2 - --- !select_min_by2 -- -7 - --- !select_min_by3 -- -1 - --- !select_intersect_count_1 -- -5 - --- !select_intersect_count_2 -- -5 - --- !select_percentile_approx1 -- -0.0 - --- !select_percentile_array -- -[255, 1989, 1991] - --- !select_array_product -- -\N -123.1230000000 -1243.5000000000 -24453.3250000000 -243243.3250000000 -243.3250000000 -604587.0000000000 -3.1410000000 --0.1230000000 --654.6540000000 --258.3690000000 -0.6660000000 -243.3250000000 -100.0010000000 -0E-10 -0E-10 - --- !select_quantile_percent -- -8.0 - --- !select_sum -- -873327.585000000000000000 - --- !select_topn_weighted1 -- -[1991, 255, -32767] - --- !select_topn_weighted2 -- -[1991, 255, -32767] - --- !select_topn_array1 -- -["yunlj8@nk", "wangynnsf", "wangjuoo4"] - --- !select_topn_array2 -- -["yunlj8@nk", "wangynnsf", "wangjuoo4"] - --- !select_topn_array3 -- -["2015-04-02", "1991-08-11", "1989-03-21"] - --- !select_topn_array4 -- -["2015-04-02", "1991-08-11", "1989-03-21"] - --- !select_topn_array5 -- -["2015-04-02 00:00:00", "2015-03-13 12:36:38", "2013-04-02 15:16:52"] - --- !select_topn_array6 -- -["2015-04-02 00:00:00", "2015-03-13 12:36:38", "2013-04-02 15:16:52"] - --- !select_count1 -- -15 - --- !select_count2 -- -15 - --- !select_minmax1 -- -20200622 1 \N -20200622 2 \N -20200622 3 \N - --- !select_minmax2 -- -20200622 - --- !select_minmax3 -- -287667876573 - --- !select_minmax4 -- -243 - --- !select_histogram_k0 -- -{"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":7,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":8,"pre_sum":7}]} - --- !select_histogram_k1 -- -{"num_buckets":1,"buckets":[{"lower":"1","upper":"15","ndv":15,"count":15,"pre_sum":0}]} - --- !select_histogram_k2 -- -{"num_buckets":2,"buckets":[{"lower":"-32767","upper":"1985","ndv":9,"count":11,"pre_sum":0},{"lower":"1986","upper":"32767","ndv":5,"count":10,"pre_sum":11}]} - --- !select_histogram_k3 -- -{"num_buckets":3,"buckets":[{"lower":"-2147483647","upper":"1001","ndv":3,"count":5,"pre_sum":0},{"lower":"1002","upper":"3021","ndv":2,"count":5,"pre_sum":5},{"lower":"5014","upper":"2147483647","ndv":3,"count":5,"pre_sum":10}]} - --- !select_histogram_k4 -- -{"num_buckets":4,"buckets":[{"lower":"-9223372036854775807","upper":"123456","ndv":4,"count":5,"pre_sum":0},{"lower":"7210457","upper":"11011903","ndv":3,"count":5,"pre_sum":5},{"lower":"11011905","upper":"11011920","ndv":2,"count":3,"pre_sum":10},{"lower":"9223372036854775807","upper":"9223372036854775807","ndv":1,"count":2,"pre_sum":13}]} - --- !select_histogram_k5 -- -{"num_buckets":5,"buckets":[{"lower":"-654.654","upper":"-0.123","ndv":3,"count":3,"pre_sum":0},{"lower":"0.000","upper":"0.666","ndv":2,"count":3,"pre_sum":3},{"lower":"3.141","upper":"123.123","ndv":3,"count":3,"pre_sum":6},{"lower":"243.325","upper":"1243.500","ndv":2,"count":3,"pre_sum":9},{"lower":"24453.325","upper":"604587.000","ndv":3,"count":3,"pre_sum":12}]} - --- !select_histogram_k6 -- -{"num_buckets":2,"buckets":[{"lower":"false","upper":"false","ndv":1,"count":8,"pre_sum":0},{"lower":"true","upper":"true","ndv":1,"count":7,"pre_sum":8}]} - --- !select_histogram_k7 -- -{"num_buckets":7,"buckets":[{"lower":"","upper":"du3lnvl","ndv":3,"count":3,"pre_sum":0},{"lower":"jiw3n4","upper":"lifsno","ndv":2,"count":2,"pre_sum":3},{"lower":"wangjuoo4","upper":"wangjuoo5","ndv":2,"count":3,"pre_sum":5},{"lower":"wangynnsf","upper":"wenlsfnl","ndv":2,"count":3,"pre_sum":8},{"lower":"yanavnd","upper":"yanavnd","ndv":1,"count":1,"pre_sum":11},{"lower":"yanvjldjlll","upper":"yanvjldjlll","ndv":1,"count":1,"pre_sum":12},{"lower":"yunlj8@nk","upper":"yunlj8@nk","ndv":1,"count":2,"pre_sum":13}]} - --- !select_histogram_k8 -- -{"num_buckets":8,"buckets":[{"lower":"-123456.54","upper":"-987.001","ndv":2,"count":2,"pre_sum":0},{"lower":"-564.898","upper":"-564.898","ndv":1,"count":1,"pre_sum":2},{"lower":"0","upper":"0","ndv":1,"count":3,"pre_sum":3},{"lower":"0.1","upper":"0.1","ndv":1,"count":2,"pre_sum":6},{"lower":"2.06","upper":"3.141592653","ndv":2,"count":2,"pre_sum":8},{"lower":"3.141592654","upper":"20.268","ndv":2,"count":2,"pre_sum":10},{"lower":"123.456","upper":"78945","ndv":2,"count":2,"pre_sum":12},{"lower":"987456.123","upper":"987456.123","ndv":1,"count":1,"pre_sum":14}]} - --- !select_histogram_k0_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k1_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k2 -- -{"num_buckets":2,"buckets":[{"lower":"10","upper":"12","ndv":3,"count":3,"pre_sum":0},{"lower":"13","upper":"15","ndv":3,"count":3,"pre_sum":3}]} - --- !select_histogram_k3_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k4_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k5_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k6_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k7_all_null -- -{"num_buckets":0,"buckets":[]} - --- !select_histogram_k8_all_null -- -{"num_buckets":0,"buckets":[]} - diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy index 0ecab68483e1f7..126c2b63f46371 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.groovy @@ -152,7 +152,14 @@ suite("test_aggregate_all_functions2") { qt_select_histogram_k5 """SELECT histogram(k5, 5) FROM baseall""" qt_select_histogram_k6 """SELECT histogram(k6, 6) FROM baseall""" qt_select_histogram_k7 """SELECT histogram(k7, 7) FROM baseall""" - qt_select_histogram_k8 """SELECT histogram(k8, 8) FROM baseall""" + // the test case for double and float is removed, becase the result is not stable since we have + // 0 and -0 in column k8, both of them are valid but we can not make both of them stand in out file. +// qt_select_histogram_k8 """SELECT histogram(k8, 8) FROM baseall""" +// qt_select_histogram_k9 """SELECT histogram(k9, 9) FROM baseall""" + qt_select_histogram_k10 """SELECT histogram(k10, 10) FROM baseall""" + qt_select_histogram_k11 """SELECT histogram(k11, 11) FROM baseall""" + qt_select_histogram_k12 """SELECT histogram(k12, 12) FROM baseall""" + qt_select_histogram_k13 """SELECT histogram(k13, 13) FROM baseall""" sql """ TRUNCATE TABLE baseall; @@ -195,5 +202,10 @@ suite("test_aggregate_all_functions2") { qt_select_histogram_k5_all_null """SELECT histogram(k5, 5) FROM baseall""" qt_select_histogram_k6_all_null """SELECT histogram(k6, 6) FROM baseall""" qt_select_histogram_k7_all_null """SELECT histogram(k7, 7) FROM baseall""" - qt_select_histogram_k8_all_null """SELECT histogram(k8, 8) FROM baseall""" +// qt_select_histogram_k8_all_null """SELECT histogram(k8, 8) FROM baseall""" +// qt_select_histogram_k9_all_null """SELECT histogram(k9, 9) FROM baseall""" + qt_select_histogram_k10_all_null """SELECT histogram(k10, 10) FROM baseall""" + qt_select_histogram_k11_all_null """SELECT histogram(k11, 11) FROM baseall""" + qt_select_histogram_k12_all_null """SELECT histogram(k12, 12) FROM baseall""" + qt_select_histogram_k13_all_null """SELECT histogram(k13, 13) FROM baseall""" } From 9d6edeb050f6fbe8655d1630dada398cfff5eb60 Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Thu, 1 Aug 2024 22:24:12 +0800 Subject: [PATCH 7/7] NEED --- .../test_aggregate_all_functions2.out | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) diff --git a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out index e69de29bb2d1d6..454d1b49353150 100644 --- a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out +++ b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions2.out @@ -0,0 +1,192 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select_approx_count_distinct1 -- +2 + +-- !select_approx_count_distinct2 -- +15 + +-- !select_collect_set1 -- +5 + +-- !select_collect_set2 -- +5 + +-- !select_collect_list1 -- +5 + +-- !select_collect_list2 -- +5 + +-- !select_histogram -- +{"num_buckets":5,"buckets":[{"lower":"","upper":"jiw3n4","ndv":4,"count":4,"pre_sum":0},{"lower":"lifsno","upper":"wangjuoo5","ndv":3,"count":4,"pre_sum":4},{"lower":"wangynnsf","upper":"yanavnd","ndv":3,"count":4,"pre_sum":8},{"lower":"yanvjldjlll","upper":"yanvjldjlll","ndv":1,"count":1,"pre_sum":12},{"lower":"yunlj8@nk","upper":"yunlj8@nk","ndv":1,"count":2,"pre_sum":13}]} + +-- !select_max_by1 -- +15 + +-- !select_max_by2 -- +8 + +-- !select_max_by3 -- +3 + +-- !select_min_by1 -- +2 + +-- !select_min_by2 -- +7 + +-- !select_min_by3 -- +1 + +-- !select_intersect_count_1 -- +5 + +-- !select_intersect_count_2 -- +5 + +-- !select_percentile_approx1 -- +0.0 + +-- !select_percentile_array -- +[255, 1989, 1991] + +-- !select_array_product -- +\N +123.1230000000 +1243.5000000000 +24453.3250000000 +243243.3250000000 +243.3250000000 +604587.0000000000 +3.1410000000 +-0.1230000000 +-654.6540000000 +-258.3690000000 +0.6660000000 +243.3250000000 +100.0010000000 +0E-10 +0E-10 + +-- !select_quantile_percent -- +8.0 + +-- !select_sum -- +873327.585000000000000000 + +-- !select_topn_weighted1 -- +[1991, 255, -32767] + +-- !select_topn_weighted2 -- +[1991, 255, -32767] + +-- !select_topn_array1 -- +["yunlj8@nk", "wangynnsf", "wangjuoo4"] + +-- !select_topn_array2 -- +["yunlj8@nk", "wangynnsf", "wangjuoo4"] + +-- !select_topn_array3 -- +["2015-04-02", "1991-08-11", "1989-03-21"] + +-- !select_topn_array4 -- +["2015-04-02", "1991-08-11", "1989-03-21"] + +-- !select_topn_array5 -- +["2015-04-02 00:00:00", "2015-03-13 12:36:38", "2013-04-02 15:16:52"] + +-- !select_topn_array6 -- +["2015-04-02 00:00:00", "2015-03-13 12:36:38", "2013-04-02 15:16:52"] + +-- !select_count1 -- +15 + +-- !select_count2 -- +15 + +-- !select_minmax1 -- +20200622 1 \N +20200622 2 \N +20200622 3 \N + +-- !select_minmax2 -- +20200622 + +-- !select_minmax3 -- +287667876573 + +-- !select_minmax4 -- +243 + +-- !select_histogram_k0 -- +{"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":7,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":8,"pre_sum":7}]} + +-- !select_histogram_k1 -- +{"num_buckets":1,"buckets":[{"lower":"1","upper":"15","ndv":15,"count":15,"pre_sum":0}]} + +-- !select_histogram_k2 -- +{"num_buckets":2,"buckets":[{"lower":"-32767","upper":"1985","ndv":9,"count":11,"pre_sum":0},{"lower":"1986","upper":"32767","ndv":5,"count":10,"pre_sum":11}]} + +-- !select_histogram_k3 -- +{"num_buckets":3,"buckets":[{"lower":"-2147483647","upper":"1001","ndv":3,"count":5,"pre_sum":0},{"lower":"1002","upper":"3021","ndv":2,"count":5,"pre_sum":5},{"lower":"5014","upper":"2147483647","ndv":3,"count":5,"pre_sum":10}]} + +-- !select_histogram_k4 -- +{"num_buckets":4,"buckets":[{"lower":"-9223372036854775807","upper":"123456","ndv":4,"count":5,"pre_sum":0},{"lower":"7210457","upper":"11011903","ndv":3,"count":5,"pre_sum":5},{"lower":"11011905","upper":"11011920","ndv":2,"count":3,"pre_sum":10},{"lower":"9223372036854775807","upper":"9223372036854775807","ndv":1,"count":2,"pre_sum":13}]} + +-- !select_histogram_k5 -- +{"num_buckets":5,"buckets":[{"lower":"-654.654","upper":"-0.123","ndv":3,"count":3,"pre_sum":0},{"lower":"0.000","upper":"0.666","ndv":2,"count":3,"pre_sum":3},{"lower":"3.141","upper":"123.123","ndv":3,"count":3,"pre_sum":6},{"lower":"243.325","upper":"1243.500","ndv":2,"count":3,"pre_sum":9},{"lower":"24453.325","upper":"604587.000","ndv":3,"count":3,"pre_sum":12}]} + +-- !select_histogram_k6 -- +{"num_buckets":2,"buckets":[{"lower":"false","upper":"false","ndv":1,"count":8,"pre_sum":0},{"lower":"true","upper":"true","ndv":1,"count":7,"pre_sum":8}]} + +-- !select_histogram_k7 -- +{"num_buckets":7,"buckets":[{"lower":"","upper":"du3lnvl","ndv":3,"count":3,"pre_sum":0},{"lower":"jiw3n4","upper":"lifsno","ndv":2,"count":2,"pre_sum":3},{"lower":"wangjuoo4","upper":"wangjuoo5","ndv":2,"count":3,"pre_sum":5},{"lower":"wangynnsf","upper":"wenlsfnl","ndv":2,"count":3,"pre_sum":8},{"lower":"yanavnd","upper":"yanavnd","ndv":1,"count":1,"pre_sum":11},{"lower":"yanvjldjlll","upper":"yanvjldjlll","ndv":1,"count":1,"pre_sum":12},{"lower":"yunlj8@nk","upper":"yunlj8@nk","ndv":1,"count":2,"pre_sum":13}]} + +-- !select_histogram_k10 -- +{"num_buckets":10,"buckets":[{"lower":"1901-12-31","upper":"1901-12-31","ndv":1,"count":1,"pre_sum":0},{"lower":"1988-03-21","upper":"1988-03-21","ndv":1,"count":1,"pre_sum":1},{"lower":"1989-03-21","upper":"1989-03-21","ndv":1,"count":2,"pre_sum":2},{"lower":"1991-08-11","upper":"1991-08-11","ndv":1,"count":2,"pre_sum":4},{"lower":"2012-03-14","upper":"2012-03-14","ndv":1,"count":1,"pre_sum":6},{"lower":"2014-11-11","upper":"2014-11-11","ndv":1,"count":1,"pre_sum":7},{"lower":"2015-01-01","upper":"2015-01-01","ndv":1,"count":1,"pre_sum":8},{"lower":"2015-04-02","upper":"2015-04-02","ndv":1,"count":4,"pre_sum":9},{"lower":"3124-10-10","upper":"3124-10-10","ndv":1,"count":1,"pre_sum":13},{"lower":"9999-12-12","upper":"9999-12-12","ndv":1,"count":1,"pre_sum":14}]} + +-- !select_histogram_k11 -- +{"num_buckets":9,"buckets":[{"lower":"1901-01-01 00:00:00","upper":"1901-01-01 00:00:00","ndv":1,"count":1,"pre_sum":0},{"lower":"1989-03-21 13:00:00","upper":"1989-03-21 13:00:00","ndv":1,"count":2,"pre_sum":1},{"lower":"1989-03-21 13:11:00","upper":"1989-03-21 13:11:00","ndv":1,"count":2,"pre_sum":3},{"lower":"2000-01-01 00:00:00","upper":"2000-01-01 00:00:00","ndv":1,"count":1,"pre_sum":5},{"lower":"2013-04-02 15:16:52","upper":"2013-04-02 15:16:52","ndv":1,"count":2,"pre_sum":6},{"lower":"2015-03-13 10:30:00","upper":"2015-03-13 10:30:00","ndv":1,"count":1,"pre_sum":8},{"lower":"2015-03-13 12:36:38","upper":"2015-03-13 12:36:38","ndv":1,"count":2,"pre_sum":9},{"lower":"2015-04-02 00:00:00","upper":"2015-04-02 00:00:00","ndv":1,"count":3,"pre_sum":11},{"lower":"9999-11-11 12:12:00","upper":"9999-11-11 12:12:00","ndv":1,"count":1,"pre_sum":14}]} + +-- !select_histogram_k12 -- +{"num_buckets":1,"buckets":[{"lower":"string12345","upper":"string12345","ndv":1,"count":15,"pre_sum":0}]} + +-- !select_histogram_k13 -- +{"num_buckets":13,"buckets":[{"lower":"-170141183460469231731687303715884105727","upper":"-20220101","ndv":2,"count":2,"pre_sum":0},{"lower":"-11011903","upper":"-2022","ndv":2,"count":2,"pre_sum":2},{"lower":"0","upper":"0","ndv":1,"count":1,"pre_sum":4},{"lower":"11011903","upper":"11011903","ndv":1,"count":1,"pre_sum":5},{"lower":"20220101","upper":"20220101","ndv":1,"count":1,"pre_sum":6},{"lower":"20220102","upper":"20220102","ndv":1,"count":1,"pre_sum":7},{"lower":"20220104","upper":"20220104","ndv":1,"count":1,"pre_sum":8},{"lower":"701411834604692317","upper":"701411834604692317","ndv":1,"count":1,"pre_sum":9},{"lower":"701411834604692317316873","upper":"701411834604692317316873","ndv":1,"count":1,"pre_sum":10},{"lower":"1701604692317316873037158","upper":"1701604692317316873037158","ndv":1,"count":1,"pre_sum":11},{"lower":"701411834604692317316873037158","upper":"701411834604692317316873037158","ndv":1,"count":1,"pre_sum":12},{"lower":"1701411834604692317316873037158","upper":"1701411834604692317316873037158","ndv":1,"count":1,"pre_sum":13},{"lower":"170141183460469231731687303715884105727","upper":"170141183460469231731687303715884105727","ndv":1,"count":1,"pre_sum":14}]} + +-- !select_histogram_k0_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k1_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k2 -- +{"num_buckets":2,"buckets":[{"lower":"10","upper":"12","ndv":3,"count":3,"pre_sum":0},{"lower":"13","upper":"15","ndv":3,"count":3,"pre_sum":3}]} + +-- !select_histogram_k3_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k4_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k5_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k6_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k7_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k10_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k11_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k12_all_null -- +{"num_buckets":0,"buckets":[]} + +-- !select_histogram_k13_all_null -- +{"num_buckets":0,"buckets":[]} +