This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new d2464ddaba5 [cherry-pick](branch-30) add float/double type in agg percentile_array (#43953) (#48094) d2464ddaba5 is described below commit d2464ddaba58c8602f7c8a01a88d78dacaaf94b2 Author: zhangstar333 <zhangs...@selectdb.com> AuthorDate: Sat Feb 22 14:05:17 2025 +0800 [cherry-pick](branch-30) add float/double type in agg percentile_array (#43953) (#48094) cherry-pick from master #43953 --- .../aggregate_function_percentile.cpp | 2 +- .../expressions/functions/agg/PercentileArray.java | 5 +++++ .../test_aggregate_percentile_no_cast.out | Bin 1372 -> 1410 bytes .../test_aggregate_percentile_no_cast.groovy | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/be/src/vec/aggregate_functions/aggregate_function_percentile.cpp b/be/src/vec/aggregate_functions/aggregate_function_percentile.cpp index bb4e1bd81e3..40b94168bf1 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_percentile.cpp +++ b/be/src/vec/aggregate_functions/aggregate_function_percentile.cpp @@ -66,7 +66,7 @@ void register_aggregate_function_percentile(AggregateFunctionSimpleFactory& fact creator_with_numeric_type::creator<AggregateFunctionPercentile>); factory.register_function_both( "percentile_array", - creator_with_integer_type::creator<AggregateFunctionPercentileArray>); + creator_with_numeric_type::creator<AggregateFunctionPercentileArray>); } void register_percentile_approx_old_function(AggregateFunctionSimpleFactory& factory) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/PercentileArray.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/PercentileArray.java index 49a0f836aed..61d4a328c0f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/PercentileArray.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/PercentileArray.java @@ -27,6 +27,7 @@ import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor; import org.apache.doris.nereids.types.ArrayType; 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.LargeIntType; import org.apache.doris.nereids.types.SmallIntType; @@ -45,6 +46,10 @@ public class PercentileArray extends NotNullableAggregateFunction implements BinaryExpression, ExplicitlyCastableSignature { public static final List<FunctionSignature> SIGNATURES = ImmutableList.of( + FunctionSignature.ret(ArrayType.of(DoubleType.INSTANCE)) + .args(DoubleType.INSTANCE, ArrayType.of(DoubleType.INSTANCE)), + FunctionSignature.ret(ArrayType.of(DoubleType.INSTANCE)) + .args(FloatType.INSTANCE, ArrayType.of(DoubleType.INSTANCE)), FunctionSignature.ret(ArrayType.of(DoubleType.INSTANCE)) .args(LargeIntType.INSTANCE, ArrayType.of(DoubleType.INSTANCE)), FunctionSignature.ret(ArrayType.of(DoubleType.INSTANCE)) diff --git a/regression-test/data/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.out b/regression-test/data/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.out index ead42332d0c..d9149d7cddd 100644 Binary files a/regression-test/data/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.out and b/regression-test/data/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.out differ diff --git a/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.groovy b/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.groovy index 412bec35d8f..816bc1f6069 100644 --- a/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.groovy +++ b/regression-test/suites/nereids_p0/sql_functions/aggregate_functions/test_aggregate_percentile_no_cast.groovy @@ -112,4 +112,21 @@ suite("test_aggregate_percentile_no_cast") { SELECT ARG0,PERCENTILE(NULLABLE(ARG0),1) OVER(ORDER BY t.ARG0 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) as a,PERCENTILE(NULLABLE(ARG0),0.9999) OVER(ORDER BY t.ARG0 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) as b,PERCENTILE(NULLABLE(ARG0),0) OVER(ORDER BY t.ARG0 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) as c,PERCENTILE(NULLABLE(ARG0),0.0001) OVER(ORDER BY t.ARG0 ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING ) as d FROM (SELECT TEMPDATA . data, [...] FROM TINYINTDATA_NOT_EMPTY_NOT_NULLABLE ) AS TABLE0) t GROUP BY ARG0 order by ARG0; """ + sql "DROP TABLE IF EXISTS percentile_test_db2" + sql """ + CREATE TABLE IF NOT EXISTS percentile_test_db2 ( + id int, + level double + ) + DISTRIBUTED BY HASH(id) BUCKETS 1 + PROPERTIES ( + "replication_num" = "1" + ) + """ + explain { + sql("""select percentile_array(level,[0.5,0.55,0.805])from percentile_test_db2;""") + notContains("cast") + } + sql "INSERT INTO percentile_test_db2 values(1,10.1), (2,8.2), (2,114.3) ,(3,10.4) ,(5,29.5) ,(6,101.6)" + qt_select "select percentile_array(level,[0.5,0.55,0.805])from percentile_test_db2;" } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org