From 3f6af0f9c5af9240cd2749ba4286f87bc4225a7c Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Fri, 8 Aug 2025 22:20:35 +0800 Subject: [PATCH 1/7] adjust skew kurtosis linerhistogram group_bit symbols --- ...gregate_function_approx_count_distinct.cpp | 2 +- .../aggregate_function_bit.cpp | 15 ++-- .../aggregate_function_histogram.cpp | 24 +++--- .../aggregate_function_kurtosis.cpp | 66 ++++------------- .../aggregate_function_linear_histogram.cpp | 74 ++++--------------- .../aggregate_function_skew.cpp | 66 ++++------------- .../trees/expressions/functions/agg/Kurt.java | 12 +-- .../trees/expressions/functions/agg/Skew.java | 7 +- 8 files changed, 62 insertions(+), 204 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp index 3e9a346385d953..4bc5da2ac723ca 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp @@ -30,7 +30,7 @@ AggregateFunctionPtr create_aggregate_function_approx_count_distinct( return creator_with_type_list< TYPE_BOOLEAN, TYPE_TINYINT, TYPE_SMALLINT, TYPE_INT, TYPE_BIGINT, TYPE_LARGEINT, TYPE_FLOAT, TYPE_DOUBLE, TYPE_DECIMAL32, TYPE_DECIMAL64, TYPE_DECIMAL128I, - TYPE_DECIMALV2, TYPE_DECIMAL256, TYPE_VARCHAR, TYPE_DATEV2, TYPE_DATETIMEV2, TYPE_IPV4, + TYPE_DECIMAL256, TYPE_VARCHAR, TYPE_DATEV2, TYPE_DATETIMEV2, TYPE_IPV4, TYPE_IPV6>::create(argument_types, result_is_nullable, attr); } diff --git a/be/src/vec/aggregate_functions/aggregate_function_bit.cpp b/be/src/vec/aggregate_functions/aggregate_function_bit.cpp index 981ced1fbd5a46..02ef6ca980c7da 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_bit.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_bit.cpp @@ -20,6 +20,7 @@ #include "vec/aggregate_functions/aggregate_function_bit.h" +#include "runtime/define_primitive_type.h" #include "vec/aggregate_functions/aggregate_function_simple_factory.h" #include "vec/aggregate_functions/helpers.h" @@ -27,15 +28,17 @@ namespace doris::vectorized { #include "common/compile_check_begin.h" void register_aggregate_function_bit(AggregateFunctionSimpleFactory& factory) { + using creator = creator_with_type_list; factory.register_function_both( - "group_bit_or", creator_with_integer_type::creator); + "group_bit_or", + creator::creator); factory.register_function_both( - "group_bit_and", creator_with_integer_type::creator); + "group_bit_and", + creator::creator); factory.register_function_both( - "group_bit_xor", creator_with_integer_type::creator); + "group_bit_xor", + creator::creator); } } // namespace doris::vectorized \ No newline at end of file diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp b/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp index ed3c997a6ccaf7..3f7dcd995b7924 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp @@ -20,6 +20,8 @@ #include #include +#include "runtime/define_primitive_type.h" +#include "vec/aggregate_functions/factory_helpers.h" #include "vec/aggregate_functions/helpers.h" #include "vec/data_types/data_type.h" @@ -36,24 +38,18 @@ AggregateFunctionPtr create_aggregate_function_histogram(const std::string& name const DataTypes& argument_types, const bool result_is_nullable, const AggregateFunctionAttr& attr) { - AggregateFunctionPtr result; + assert_arity_range(name, argument_types, 1, 2); + using creator = + creator_with_type_list; if (argument_types.size() == 2) { - result = creator_with_any::create( - argument_types, result_is_nullable, attr); - } else if (argument_types.size() == 1) { - result = creator_with_any::create( + return creator::create( argument_types, result_is_nullable, attr); } else { - throw Exception(ErrorCode::INVALID_ARGUMENT, - "Aggregate function histogram requires 1 or 2 arguments, but got {}", - argument_types.size()); - } - if (!result) { - throw Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, - "Aggregate function histogram does not support type {}", - argument_types[0]->get_primitive_type()); + return creator::create( + argument_types, result_is_nullable, attr); } - return result; } void register_aggregate_function_histogram(AggregateFunctionSimpleFactory& factory) { diff --git a/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp b/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp index 0ef0b42cfe65f6..2c9ea28684129d 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp @@ -18,18 +18,25 @@ #include "vec/aggregate_functions/aggregate_function.h" #include "vec/aggregate_functions/aggregate_function_simple_factory.h" #include "vec/aggregate_functions/aggregate_function_statistic.h" +#include "vec/aggregate_functions/factory_helpers.h" #include "vec/aggregate_functions/helpers.h" #include "vec/data_types/data_type.h" namespace doris::vectorized { #include "common/compile_check_begin.h" -template -AggregateFunctionPtr type_dispatch_for_aggregate_function_kurt(const DataTypes& argument_types, - const bool result_is_nullable, - bool nullable_input, - const AggregateFunctionAttr& attr) { - using StatFunctionTemplate = StatFuncOneArg; +AggregateFunctionPtr create_aggregate_function_kurt(const std::string& name, + const DataTypes& argument_types, + const bool result_is_nullable, + const AggregateFunctionAttr& attr) { + assert_arity_range(name, argument_types, 1, 1); + if (!result_is_nullable) { + throw doris::Exception(ErrorCode::INTERNAL_ERROR, + "Aggregate function {} requires result_is_nullable", name); + } + + const bool nullable_input = argument_types[0]->is_nullable(); + using StatFunctionTemplate = StatFuncOneArg; if (nullable_input) { return creator_without_type::create_ignore_nullable< @@ -40,53 +47,6 @@ AggregateFunctionPtr type_dispatch_for_aggregate_function_kurt(const DataTypes& AggregateFunctionVarianceSimple>( argument_types, result_is_nullable, attr, STATISTICS_FUNCTION_KIND::KURT_POP); } -}; - -AggregateFunctionPtr create_aggregate_function_kurt(const std::string& name, - const DataTypes& argument_types, - const bool result_is_nullable, - const AggregateFunctionAttr& attr) { - if (argument_types.size() != 1) { - LOG(WARNING) << "aggregate function " << name << " requires exactly 1 argument"; - return nullptr; - } - - if (!result_is_nullable) { - LOG(WARNING) << "aggregate function " << name << " requires nullable result type"; - return nullptr; - } - - const bool nullable_input = argument_types[0]->is_nullable(); - switch (argument_types[0]->get_primitive_type()) { - case PrimitiveType::TYPE_BOOLEAN: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_TINYINT: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_SMALLINT: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_INT: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_BIGINT: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_LARGEINT: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_FLOAT: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - case PrimitiveType::TYPE_DOUBLE: - return type_dispatch_for_aggregate_function_kurt( - argument_types, result_is_nullable, nullable_input, attr); - default: - LOG(WARNING) << "unsupported input type " << argument_types[0]->get_name() - << " for aggregate function " << name; - return nullptr; - } } void register_aggregate_function_kurtosis(AggregateFunctionSimpleFactory& factory) { diff --git a/be/src/vec/aggregate_functions/aggregate_function_linear_histogram.cpp b/be/src/vec/aggregate_functions/aggregate_function_linear_histogram.cpp index cf22f6b47efb7e..a140159c5541e5 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_linear_histogram.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_linear_histogram.cpp @@ -24,72 +24,26 @@ namespace doris::vectorized { const std::string AggregateFunctionLinearHistogramConsts::NAME = "linear_histogram"; -template -AggregateFunctionPtr create_agg_function_linear_histogram(const DataTypes& argument_types, - const bool result_is_nullable, - const AggregateFunctionAttr& attr) { - bool has_offset = (argument_types.size() == 3); +template +using HistogramWithInputParam = AggregateFunctionLinearHistogram; - if (has_offset) { - return creator_without_type::create< - AggregateFunctionLinearHistogram, true>>( - argument_types, result_is_nullable, attr); - } else { - return creator_without_type::create, false>>(argument_types, - result_is_nullable, attr); - } -} +template +using HistogramNormal = AggregateFunctionLinearHistogram; AggregateFunctionPtr create_aggregate_function_linear_histogram(const std::string& name, const DataTypes& argument_types, const bool result_is_nullable, const AggregateFunctionAttr& attr) { - switch (argument_types[0]->get_primitive_type()) { - case PrimitiveType::TYPE_BOOLEAN: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_TINYINT: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_SMALLINT: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_INT: - return create_agg_function_linear_histogram(argument_types, result_is_nullable, - attr); - case PrimitiveType::TYPE_BIGINT: - return create_agg_function_linear_histogram(argument_types, result_is_nullable, - attr); - case PrimitiveType::TYPE_LARGEINT: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_FLOAT: - return create_agg_function_linear_histogram(argument_types, result_is_nullable, - attr); - case PrimitiveType::TYPE_DOUBLE: - return create_agg_function_linear_histogram(argument_types, result_is_nullable, - attr); - case PrimitiveType::TYPE_DECIMAL32: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_DECIMAL64: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_DECIMAL128I: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_DECIMALV2: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - case PrimitiveType::TYPE_DECIMAL256: - return create_agg_function_linear_histogram(argument_types, - result_is_nullable, attr); - default: - - LOG(WARNING) << fmt::format("unsupported input type {} for aggregate function {}", - argument_types[0]->get_name(), name); - return nullptr; + using creator = creator_with_type_list; + bool has_offset = (argument_types.size() == 3); + if (has_offset) { + return creator::create( + argument_types, result_is_nullable, attr); + } else { + return creator::create( + argument_types, result_is_nullable, attr); } } diff --git a/be/src/vec/aggregate_functions/aggregate_function_skew.cpp b/be/src/vec/aggregate_functions/aggregate_function_skew.cpp index 4e66e21a56d6a8..8881b8ab640eff 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_skew.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_skew.cpp @@ -18,18 +18,25 @@ #include "vec/aggregate_functions/aggregate_function.h" #include "vec/aggregate_functions/aggregate_function_simple_factory.h" #include "vec/aggregate_functions/aggregate_function_statistic.h" +#include "vec/aggregate_functions/factory_helpers.h" #include "vec/aggregate_functions/helpers.h" #include "vec/data_types/data_type.h" namespace doris::vectorized { #include "common/compile_check_begin.h" -template -AggregateFunctionPtr type_dispatch_for_aggregate_function_skew(const DataTypes& argument_types, - const bool result_is_nullable, - const AggregateFunctionAttr& attr, - bool nullable_input) { - using StatFunctionTemplate = StatFuncOneArg; +AggregateFunctionPtr create_aggregate_function_skew(const std::string& name, + const DataTypes& argument_types, + const bool result_is_nullable, + const AggregateFunctionAttr& attr) { + assert_arity_range(name, argument_types, 1, 1); + if (!result_is_nullable) { + throw doris::Exception(ErrorCode::INTERNAL_ERROR, + "Aggregate function {} requires result_is_nullable", name); + } + + const bool nullable_input = argument_types[0]->is_nullable(); + using StatFunctionTemplate = StatFuncOneArg; if (nullable_input) { return creator_without_type::create_ignore_nullable< @@ -40,53 +47,6 @@ AggregateFunctionPtr type_dispatch_for_aggregate_function_skew(const DataTypes& AggregateFunctionVarianceSimple>( argument_types, result_is_nullable, attr, STATISTICS_FUNCTION_KIND::SKEW_POP); } -}; - -AggregateFunctionPtr create_aggregate_function_skew(const std::string& name, - const DataTypes& argument_types, - const bool result_is_nullable, - const AggregateFunctionAttr& attr) { - if (argument_types.size() != 1) { - LOG(WARNING) << "aggregate function " << name << " requires exactly 1 argument"; - return nullptr; - } - - if (!result_is_nullable) { - LOG(WARNING) << "aggregate function " << name << " requires nullable result type"; - return nullptr; - } - - const bool nullable_input = argument_types[0]->is_nullable(); - switch (argument_types[0]->get_primitive_type()) { - case PrimitiveType::TYPE_BOOLEAN: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_TINYINT: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_SMALLINT: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_INT: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_BIGINT: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_LARGEINT: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_FLOAT: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - case PrimitiveType::TYPE_DOUBLE: - return type_dispatch_for_aggregate_function_skew( - argument_types, result_is_nullable, attr, nullable_input); - default: - LOG(WARNING) << "unsupported input type " << argument_types[0]->get_name() - << " for aggregate function " << name; - return nullptr; - } } void register_aggregate_function_skewness(AggregateFunctionSimpleFactory& factory) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Kurt.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Kurt.java index 4edf318e47687b..d48cf37089cc07 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Kurt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Kurt.java @@ -23,12 +23,7 @@ import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; -import org.apache.doris.nereids.types.BigIntType; import org.apache.doris.nereids.types.DoubleType; -import org.apache.doris.nereids.types.FloatType; -import org.apache.doris.nereids.types.IntegerType; -import org.apache.doris.nereids.types.SmallIntType; -import org.apache.doris.nereids.types.TinyIntType; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; @@ -42,12 +37,7 @@ public class Kurt extends AggregateFunction implements UnaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( - FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(BigIntType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(IntegerType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(SmallIntType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(TinyIntType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(FloatType.INSTANCE) + FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE) ); public Kurt(Expression arg1) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java index 4ea2e786b85349..6c1da0547795a2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java @@ -43,12 +43,7 @@ public class Skew extends AggregateFunction implements UnaryExpression, ExplicitlyCastableSignature, AlwaysNullable { public static final List SIGNATURES = ImmutableList.of( - FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(BigIntType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(IntegerType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(SmallIntType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(TinyIntType.INSTANCE), - FunctionSignature.ret(DoubleType.INSTANCE).args(FloatType.INSTANCE) + FunctionSignature.ret(DoubleType.INSTANCE).args(DoubleType.INSTANCE) ); public Skew(Expression arg1) { From dbd1bc01cef718552864c6b0049b4e095ef62b81 Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Sat, 9 Aug 2025 10:06:46 +0800 Subject: [PATCH 2/7] update --- .../vec/aggregate_functions/aggregate_function_kurtosis.cpp | 2 +- .../doris/nereids/trees/expressions/functions/agg/Skew.java | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp b/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp index 2c9ea28684129d..6c6c0f0ca15ced 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_kurtosis.cpp @@ -36,7 +36,7 @@ AggregateFunctionPtr create_aggregate_function_kurt(const std::string& name, } const bool nullable_input = argument_types[0]->is_nullable(); - using StatFunctionTemplate = StatFuncOneArg; + using StatFunctionTemplate = StatFuncOneArg; if (nullable_input) { return creator_without_type::create_ignore_nullable< diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java index 6c1da0547795a2..aa46bcecc12c3c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Skew.java @@ -23,12 +23,7 @@ import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature; import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression; import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; -import org.apache.doris.nereids.types.BigIntType; import org.apache.doris.nereids.types.DoubleType; -import org.apache.doris.nereids.types.FloatType; -import org.apache.doris.nereids.types.IntegerType; -import org.apache.doris.nereids.types.SmallIntType; -import org.apache.doris.nereids.types.TinyIntType; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; From 60247eba0ea19b050ea1cfac117f78ee04f52d84 Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Sat, 9 Aug 2025 13:53:31 +0800 Subject: [PATCH 3/7] fix --- .../agg_histogram_test.cpp | 6 ----- .../agg_function/agg.groovy | 27 ------------------- .../test_aggregate_histogram.groovy | 1 - .../test_aggregate_histogram.groovy | 1 - 4 files changed, 35 deletions(-) diff --git a/be/test/vec/aggregate_functions/agg_histogram_test.cpp b/be/test/vec/aggregate_functions/agg_histogram_test.cpp index 0cf091f79522b9..6f695e7064630c 100644 --- a/be/test/vec/aggregate_functions/agg_histogram_test.cpp +++ b/be/test/vec/aggregate_functions/agg_histogram_test.cpp @@ -214,10 +214,7 @@ TEST_F(VAggHistogramTest, test_empty) { test_agg_histogram(); test_agg_histogram(); - test_agg_histogram(); - test_agg_histogram(); test_agg_histogram(); - test_agg_histogram(); } TEST_F(VAggHistogramTest, test_with_data) { @@ -231,13 +228,10 @@ TEST_F(VAggHistogramTest, test_with_data) { test_agg_histogram(100, 5); test_agg_histogram(100, 5); - test_agg_histogram(100, 5); test_agg_histogram(100, 5); - test_agg_histogram(100, 5); test_agg_histogram(100, 5); - test_agg_histogram(100, 5); } } // namespace doris::vectorized diff --git a/regression-test/suites/nereids_function_p0/agg_function/agg.groovy b/regression-test/suites/nereids_function_p0/agg_function/agg.groovy index b3dace65e72fb7..727cedc322f149 100644 --- a/regression-test/suites/nereids_function_p0/agg_function/agg.groovy +++ b/regression-test/suites/nereids_function_p0/agg_function/agg.groovy @@ -1095,33 +1095,6 @@ suite("nereids_agg_fn") { // qt_sql_group_concat_Varchar_Varchar_AnyData_agg_phase_1_notnull ''' // select count(id), group_concat(distinct cast(abs(kint) as varchar), '_x_' order by abs(ksint), kdt) from fn_test_not_nullable group by id order by id''' - sql ''' - select histogram(kbool) from fn_test group by kbool order by kbool''' - sql ''' - select histogram(kbool) from fn_test''' - sql ''' - select histogram(kbool, 10) from fn_test''' - sql ''' - select count(id), histogram(kbool) from fn_test group by id order by id''' - sql ''' - select count(distinct id), histogram(kbool) from fn_test''' - sql ''' - select /*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id, kint), histogram(kbool) from fn_test group by kbool order by kbool''' - sql ''' - select /*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id), histogram(kbool) from fn_test''' - sql ''' - select histogram(kbool) from fn_test_not_nullable group by kbool order by kbool''' - sql ''' - select histogram(kbool) from fn_test_not_nullable''' - sql ''' - select count(id), histogram(kbool) from fn_test_not_nullable group by id order by id''' - sql ''' - select count(distinct id), histogram(kbool) from fn_test_not_nullable''' - sql ''' - select /*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id, kint), histogram(kbool) from fn_test group by kbool order by kbool''' - sql ''' - select /*+SET_VAR(disable_nereids_rules='THREE_PHASE_AGGREGATE_WITH_DISTINCT, TWO_PHASE_AGGREGATE_WITH_DISTINCT')*/ count(distinct id), histogram(kbool) from fn_test''' - sql ''' select histogram(ktint) from fn_test group by kbool order by kbool''' sql ''' diff --git a/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy b/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy index 1604f38d72f1c6..e27a90330a9936 100644 --- a/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy +++ b/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy @@ -108,7 +108,6 @@ // // If it does, need to add a similar method histogramhist(c_decimalv3, 2). // qt_select """ // SELECT -// histogram(c_bool, 2), // histogram(c_tinyint, 2), // histogram(c_smallint, 2), // histogram(c_bigint, 2), diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy index 6f12c29656dca3..cf420277602b15 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy @@ -103,7 +103,6 @@ suite("test_aggregate_histogram") { // Test without GROUP BY qt_select """ SELECT - histogram(c_bool, 2), histogram(c_tinyint, 2), histogram(c_smallint, 2), histogram(c_bigint, 2), From 96b502c6c3d886c0ca42adbf7ce6e16f535b677f Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Sat, 9 Aug 2025 14:02:35 +0800 Subject: [PATCH 4/7] fix --- be/test/vec/aggregate_functions/agg_histogram_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/be/test/vec/aggregate_functions/agg_histogram_test.cpp b/be/test/vec/aggregate_functions/agg_histogram_test.cpp index 6f695e7064630c..1d8dffcef2bec8 100644 --- a/be/test/vec/aggregate_functions/agg_histogram_test.cpp +++ b/be/test/vec/aggregate_functions/agg_histogram_test.cpp @@ -231,7 +231,6 @@ TEST_F(VAggHistogramTest, test_with_data) { test_agg_histogram(100, 5); test_agg_histogram(100, 5); - } } // namespace doris::vectorized From b06689d0380f430390e0d4f02799d5271d023fc6 Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Sat, 9 Aug 2025 15:04:53 +0800 Subject: [PATCH 5/7] update --- .../aggregate_functions/aggregate_function_histogram.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp b/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp index 3f7dcd995b7924..cf1ed9f8a846df 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_histogram.cpp @@ -39,10 +39,10 @@ AggregateFunctionPtr create_aggregate_function_histogram(const std::string& name const bool result_is_nullable, const AggregateFunctionAttr& attr) { assert_arity_range(name, argument_types, 1, 2); - using creator = - creator_with_type_list; + using creator = creator_with_type_list; if (argument_types.size() == 2) { return creator::create( argument_types, result_is_nullable, attr); From c3bab91a226f0bc9e29881d27be6579b14e50b9a Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Sat, 9 Aug 2025 17:21:30 +0800 Subject: [PATCH 6/7] update --- .../aggregate_functions/test_aggregate_histogram.out | 10 +++++----- .../test_aggregate_histogram.groovy | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.out b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.out index 0732300a97b1a3..124e43be05bea7 100644 --- a/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.out +++ b/regression-test/data/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.out @@ -1,14 +1,14 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !select -- -{"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":4,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"10","upper":"11","ndv":2,"count":4,"pre_sum":0},{"lower":"21","upper":"31","ndv":2,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":3,"pre_sum":0},{"lower":"21","upper":"32","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":3,"count":3,"pre_sum":0},{"lower":"3444444444444","upper":"4444444444444","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":3,"count":3,"pre_sum":0},{"lower":"9555555555","upper":"55555555555","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"1.1","ndv":2,"count":3,"pre_sum":0},{"lower":"2.1","upper":"9.1","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"1.222","ndv":2,"count":3,"pre_sum":0},{"lower":"2.222","upper":"9.222","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"13333.33","ndv":2,"count":3,"pre_sum":0},{"lower":"23333.33","upper":"93333.33","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"14444.44","ndv":2,"count":3,"pre_sum":0},{"lower":"24444.44","upper":"94444.44","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"d","ndv":2,"count":3,"pre_sum":0},{"lower":"f","upper":"p","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar2","ndv":2,"count":3,"pre_sum":0},{"lower":"varchar3","upper":"varchar9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string2","ndv":2,"count":3,"pre_sum":0},{"lower":"string3","upper":"string9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-02 22:23:23","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:23","upper":"2022-12-09 22:23:23","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":12,"pre_sum":0}]} +{"num_buckets":2,"buckets":[{"lower":"10","upper":"11","ndv":2,"count":4,"pre_sum":0},{"lower":"21","upper":"31","ndv":2,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":3,"pre_sum":0},{"lower":"21","upper":"32","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":3,"count":3,"pre_sum":0},{"lower":"3444444444444","upper":"4444444444444","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":3,"count":3,"pre_sum":0},{"lower":"9555555555","upper":"55555555555","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"1.1","ndv":2,"count":3,"pre_sum":0},{"lower":"2.1","upper":"9.1","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"1.222","ndv":2,"count":3,"pre_sum":0},{"lower":"2.222","upper":"9.222","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"13333.33","ndv":2,"count":3,"pre_sum":0},{"lower":"23333.33","upper":"93333.33","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"14444.44","ndv":2,"count":3,"pre_sum":0},{"lower":"24444.44","upper":"94444.44","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"d","ndv":2,"count":3,"pre_sum":0},{"lower":"f","upper":"p","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar2","ndv":2,"count":3,"pre_sum":0},{"lower":"varchar3","upper":"varchar9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string2","ndv":2,"count":3,"pre_sum":0},{"lower":"string3","upper":"string9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-02 22:23:23","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:23","upper":"2022-12-09 22:23:23","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":12,"pre_sum":0}]} -- !select -- -1 {"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":2,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"10","upper":"10","ndv":1,"count":1,"pre_sum":0},{"lower":"11","upper":"11","ndv":1,"count":2,"pre_sum":1}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":2,"pre_sum":0},{"lower":"21","upper":"21","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"1444444444444","upper":"1444444444444","ndv":1,"count":1,"pre_sum":0},{"lower":"4444444444444","upper":"4444444444444","ndv":1,"count":2,"pre_sum":1}]} {"num_buckets":2,"buckets":[{"lower":"1555555555","upper":"1555555555","ndv":1,"count":1,"pre_sum":0},{"lower":"55555555555","upper":"55555555555","ndv":1,"count":2,"pre_sum":1}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"0.1","ndv":1,"count":2,"pre_sum":0},{"lower":"1.1","upper":"1.1","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"0.222","ndv":1,"count":2,"pre_sum":0},{"lower":"1.222","upper":"1.222","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"3333.33","ndv":1,"count":2,"pre_sum":0},{"lower":"13333.33","upper":"13333.33","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"4444.44","ndv":1,"count":2,"pre_sum":0},{"lower":"14444.44","upper":"14444.44","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"c","ndv":1,"count":2,"pre_sum":0},{"lower":"d","upper":"d","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar1","ndv":1,"count":2,"pre_sum":0},{"lower":"varchar2","upper":"varchar2","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string1","ndv":1,"count":2,"pre_sum":0},{"lower":"string2","upper":"string2","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-01","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02","upper":"2022-12-02","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-01","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02","upper":"2022-12-02","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-01 22:23:23","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02 22:23:23","upper":"2022-12-02 22:23:23","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-01 22:23:24.999999","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":6,"pre_sum":0}]} -2 {"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":2,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"10","upper":"21","ndv":2,"count":2,"pre_sum":0},{"lower":"31","upper":"31","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"20","upper":"22","ndv":2,"count":2,"pre_sum":0},{"lower":"32","upper":"32","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":2,"count":2,"pre_sum":0},{"lower":"3444444444444","upper":"3444444444444","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":2,"count":2,"pre_sum":0},{"lower":"9555555555","upper":"9555555555","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2.1","upper":"3.1","ndv":2,"count":2,"pre_sum":0},{"lower":"9.1","upper":"9.1","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2.222","upper":"3.222","ndv":2,"count":2,"pre_sum":0},{"lower":"9.222","upper":"9.222","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"23333.33","upper":"33333.33","ndv":2,"count":2,"pre_sum":0},{"lower":"93333.33","upper":"93333.33","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"24444.44","upper":"34444.44","ndv":2,"count":2,"pre_sum":0},{"lower":"94444.44","upper":"94444.44","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"f","upper":"l","ndv":2,"count":2,"pre_sum":0},{"lower":"p","upper":"p","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"varchar3","upper":"varchar3","ndv":1,"count":2,"pre_sum":0},{"lower":"varchar9","upper":"varchar9","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"string3","upper":"string3","ndv":1,"count":2,"pre_sum":0},{"lower":"string9","upper":"string9","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03","upper":"2022-12-03","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09","upper":"2022-12-09","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03","upper":"2022-12-03","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09","upper":"2022-12-09","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03 22:23:23","upper":"2022-12-03 22:23:23","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09 22:23:23","upper":"2022-12-09 22:23:23","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-03 22:23:24.999999","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":6,"pre_sum":0}]} +1 {"num_buckets":2,"buckets":[{"lower":"10","upper":"10","ndv":1,"count":1,"pre_sum":0},{"lower":"11","upper":"11","ndv":1,"count":2,"pre_sum":1}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":2,"pre_sum":0},{"lower":"21","upper":"21","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"1444444444444","upper":"1444444444444","ndv":1,"count":1,"pre_sum":0},{"lower":"4444444444444","upper":"4444444444444","ndv":1,"count":2,"pre_sum":1}]} {"num_buckets":2,"buckets":[{"lower":"1555555555","upper":"1555555555","ndv":1,"count":1,"pre_sum":0},{"lower":"55555555555","upper":"55555555555","ndv":1,"count":2,"pre_sum":1}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"0.1","ndv":1,"count":2,"pre_sum":0},{"lower":"1.1","upper":"1.1","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"0.222","ndv":1,"count":2,"pre_sum":0},{"lower":"1.222","upper":"1.222","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"3333.33","ndv":1,"count":2,"pre_sum":0},{"lower":"13333.33","upper":"13333.33","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"4444.44","ndv":1,"count":2,"pre_sum":0},{"lower":"14444.44","upper":"14444.44","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"c","ndv":1,"count":2,"pre_sum":0},{"lower":"d","upper":"d","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar1","ndv":1,"count":2,"pre_sum":0},{"lower":"varchar2","upper":"varchar2","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string1","ndv":1,"count":2,"pre_sum":0},{"lower":"string2","upper":"string2","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-01","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02","upper":"2022-12-02","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-01","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02","upper":"2022-12-02","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-01 22:23:23","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02 22:23:23","upper":"2022-12-02 22:23:23","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-01 22:23:24.999999","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-02 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":6,"pre_sum":0}]} +2 {"num_buckets":2,"buckets":[{"lower":"10","upper":"21","ndv":2,"count":2,"pre_sum":0},{"lower":"31","upper":"31","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"20","upper":"22","ndv":2,"count":2,"pre_sum":0},{"lower":"32","upper":"32","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":2,"count":2,"pre_sum":0},{"lower":"3444444444444","upper":"3444444444444","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":2,"count":2,"pre_sum":0},{"lower":"9555555555","upper":"9555555555","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2.1","upper":"3.1","ndv":2,"count":2,"pre_sum":0},{"lower":"9.1","upper":"9.1","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2.222","upper":"3.222","ndv":2,"count":2,"pre_sum":0},{"lower":"9.222","upper":"9.222","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"23333.33","upper":"33333.33","ndv":2,"count":2,"pre_sum":0},{"lower":"93333.33","upper":"93333.33","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"24444.44","upper":"34444.44","ndv":2,"count":2,"pre_sum":0},{"lower":"94444.44","upper":"94444.44","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"f","upper":"l","ndv":2,"count":2,"pre_sum":0},{"lower":"p","upper":"p","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"varchar3","upper":"varchar3","ndv":1,"count":2,"pre_sum":0},{"lower":"varchar9","upper":"varchar9","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"string3","upper":"string3","ndv":1,"count":2,"pre_sum":0},{"lower":"string9","upper":"string9","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03","upper":"2022-12-03","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09","upper":"2022-12-09","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03","upper":"2022-12-03","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09","upper":"2022-12-09","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03 22:23:23","upper":"2022-12-03 22:23:23","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09 22:23:23","upper":"2022-12-09 22:23:23","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-03 22:23:24.999999","ndv":1,"count":2,"pre_sum":0},{"lower":"2022-12-09 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":1,"count":1,"pre_sum":2}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":6,"pre_sum":0}]} -- !select -- -1 {"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":4,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"10","upper":"11","ndv":2,"count":4,"pre_sum":0},{"lower":"21","upper":"31","ndv":2,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":3,"pre_sum":0},{"lower":"21","upper":"32","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":3,"count":3,"pre_sum":0},{"lower":"3444444444444","upper":"4444444444444","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":3,"count":3,"pre_sum":0},{"lower":"9555555555","upper":"55555555555","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"1.1","ndv":2,"count":3,"pre_sum":0},{"lower":"2.1","upper":"9.1","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"1.222","ndv":2,"count":3,"pre_sum":0},{"lower":"2.222","upper":"9.222","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"13333.33","ndv":2,"count":3,"pre_sum":0},{"lower":"23333.33","upper":"93333.33","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"14444.44","ndv":2,"count":3,"pre_sum":0},{"lower":"24444.44","upper":"94444.44","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"d","ndv":2,"count":3,"pre_sum":0},{"lower":"f","upper":"p","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar2","ndv":2,"count":3,"pre_sum":0},{"lower":"varchar3","upper":"varchar9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string2","ndv":2,"count":3,"pre_sum":0},{"lower":"string3","upper":"string9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-02 22:23:23","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:23","upper":"2022-12-09 22:23:23","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":12,"pre_sum":0}]} +1 {"num_buckets":2,"buckets":[{"lower":"10","upper":"11","ndv":2,"count":4,"pre_sum":0},{"lower":"21","upper":"31","ndv":2,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":3,"pre_sum":0},{"lower":"21","upper":"32","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":3,"count":3,"pre_sum":0},{"lower":"3444444444444","upper":"4444444444444","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":3,"count":3,"pre_sum":0},{"lower":"9555555555","upper":"55555555555","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"1.1","ndv":2,"count":3,"pre_sum":0},{"lower":"2.1","upper":"9.1","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"1.222","ndv":2,"count":3,"pre_sum":0},{"lower":"2.222","upper":"9.222","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"13333.33","ndv":2,"count":3,"pre_sum":0},{"lower":"23333.33","upper":"93333.33","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"14444.44","ndv":2,"count":3,"pre_sum":0},{"lower":"24444.44","upper":"94444.44","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"d","ndv":2,"count":3,"pre_sum":0},{"lower":"f","upper":"p","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar2","ndv":2,"count":3,"pre_sum":0},{"lower":"varchar3","upper":"varchar9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string2","ndv":2,"count":3,"pre_sum":0},{"lower":"string3","upper":"string9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-02 22:23:23","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:23","upper":"2022-12-09 22:23:23","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":12,"pre_sum":0}]} -- !select -- -1 {"num_buckets":2,"buckets":[{"lower":"0","upper":"0","ndv":1,"count":4,"pre_sum":0},{"lower":"1","upper":"1","ndv":1,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"10","upper":"11","ndv":2,"count":4,"pre_sum":0},{"lower":"21","upper":"31","ndv":2,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":3,"pre_sum":0},{"lower":"21","upper":"32","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":3,"count":3,"pre_sum":0},{"lower":"3444444444444","upper":"4444444444444","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":3,"count":3,"pre_sum":0},{"lower":"9555555555","upper":"55555555555","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"1.1","ndv":2,"count":3,"pre_sum":0},{"lower":"2.1","upper":"9.1","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"1.222","ndv":2,"count":3,"pre_sum":0},{"lower":"2.222","upper":"9.222","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"13333.33","ndv":2,"count":3,"pre_sum":0},{"lower":"23333.33","upper":"93333.33","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"14444.44","ndv":2,"count":3,"pre_sum":0},{"lower":"24444.44","upper":"94444.44","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"d","ndv":2,"count":3,"pre_sum":0},{"lower":"f","upper":"p","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar2","ndv":2,"count":3,"pre_sum":0},{"lower":"varchar3","upper":"varchar9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string2","ndv":2,"count":3,"pre_sum":0},{"lower":"string3","upper":"string9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-02 22:23:23","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:23","upper":"2022-12-09 22:23:23","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":12,"pre_sum":0}]} +1 {"num_buckets":2,"buckets":[{"lower":"10","upper":"11","ndv":2,"count":4,"pre_sum":0},{"lower":"21","upper":"31","ndv":2,"count":2,"pre_sum":4}]} {"num_buckets":2,"buckets":[{"lower":"12","upper":"20","ndv":2,"count":3,"pre_sum":0},{"lower":"21","upper":"32","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"944444444444","upper":"2444444444444","ndv":3,"count":3,"pre_sum":0},{"lower":"3444444444444","upper":"4444444444444","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"255555555","upper":"3555555555","ndv":3,"count":3,"pre_sum":0},{"lower":"9555555555","upper":"55555555555","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.1","upper":"1.1","ndv":2,"count":3,"pre_sum":0},{"lower":"2.1","upper":"9.1","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"0.222","upper":"1.222","ndv":2,"count":3,"pre_sum":0},{"lower":"2.222","upper":"9.222","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"3333.33","upper":"13333.33","ndv":2,"count":3,"pre_sum":0},{"lower":"23333.33","upper":"93333.33","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"4444.44","upper":"14444.44","ndv":2,"count":3,"pre_sum":0},{"lower":"24444.44","upper":"94444.44","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"c","upper":"d","ndv":2,"count":3,"pre_sum":0},{"lower":"f","upper":"p","ndv":3,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"varchar1","upper":"varchar2","ndv":2,"count":3,"pre_sum":0},{"lower":"varchar3","upper":"varchar9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"string1","upper":"string2","ndv":2,"count":3,"pre_sum":0},{"lower":"string3","upper":"string9","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01","upper":"2022-12-02","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03","upper":"2022-12-09","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:23","upper":"2022-12-02 22:23:23","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:23","upper":"2022-12-09 22:23:23","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":2,"buckets":[{"lower":"2022-12-01 22:23:24.999999","upper":"2022-12-02 22:23:24.999999","ndv":2,"count":3,"pre_sum":0},{"lower":"2022-12-03 22:23:24.999999","upper":"2022-12-09 22:23:24.999999","ndv":2,"count":3,"pre_sum":3}]} {"num_buckets":1,"buckets":[{"lower":"not null","upper":"not null","ndv":1,"count":12,"pre_sum":0}]} diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy index cf420277602b15..dc3cba39171c56 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_histogram.groovy @@ -127,7 +127,6 @@ suite("test_aggregate_histogram") { qt_select """ SELECT c_id, - hist(c_bool, 2), hist(c_tinyint, 2), hist(c_smallint, 2), hist(c_bigint, 2), @@ -156,7 +155,6 @@ suite("test_aggregate_histogram") { CREATE TABLE ${tableCTAS1} PROPERTIES("replication_num" = "1") AS SELECT 1, - hist(c_bool, 2), hist(c_tinyint, 2), hist(c_smallint, 2), hist(c_bigint, 2), @@ -181,7 +179,6 @@ suite("test_aggregate_histogram") { CREATE TABLE ${tableCTAS2} PROPERTIES("replication_num" = "1") AS SELECT 1, - hist(c_bool, 2), hist(c_tinyint, 2), hist(c_smallint, 2), hist(c_bigint, 2), From 4dc8a17c097e7454773a96a436397ceb345aa3a0 Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Sat, 9 Aug 2025 18:40:47 +0800 Subject: [PATCH 7/7] fix --- be/test/vec/aggregate_functions/agg_linear_histogram_test.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/be/test/vec/aggregate_functions/agg_linear_histogram_test.cpp b/be/test/vec/aggregate_functions/agg_linear_histogram_test.cpp index 2111e55b8bafa5..bde2669ac68870 100644 --- a/be/test/vec/aggregate_functions/agg_linear_histogram_test.cpp +++ b/be/test/vec/aggregate_functions/agg_linear_histogram_test.cpp @@ -301,7 +301,6 @@ TEST_F(AggLinearHistogramTest, test_empty) { test_agg_linear_histogram(0, 0.5, 0); test_agg_linear_histogram(0, 0.5, 0); - test_agg_linear_histogram(0, 0.5, 0); test_agg_linear_histogram(0, 0.5, 0); test_agg_linear_histogram(0, 0.5, 0); } @@ -318,7 +317,6 @@ TEST_F(AggLinearHistogramTest, test_with_data) { test_agg_linear_histogram(5, 0.5, 0); test_agg_linear_histogram(5, 0.5, 0); - test_agg_linear_histogram(5, 0.5, 0); test_agg_linear_histogram(5, 0.5, 0); test_agg_linear_histogram(5, 0.5, 0); @@ -333,7 +331,6 @@ TEST_F(AggLinearHistogramTest, test_with_data) { test_agg_linear_histogram(5, 0.5, 0.25); test_agg_linear_histogram(5, 0.5, 0.25); - test_agg_linear_histogram(5, 0.5, 0.25); test_agg_linear_histogram(5, 0.5, 0.25); test_agg_linear_histogram(5, 0.5, 0.25); }