From b072af9946c663157f4874b5db456114af52eef5 Mon Sep 17 00:00:00 2001 From: Mryange Date: Mon, 3 Mar 2025 17:35:58 +0800 Subject: [PATCH 1/2] fix --- .../aggregate_function_percentile.h | 1 + .../test_aggregate_all_functions.groovy | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/be/src/vec/aggregate_functions/aggregate_function_percentile.h b/be/src/vec/aggregate_functions/aggregate_function_percentile.h index dbd52af923f71b..9dfb31864bae84 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_percentile.h +++ b/be/src/vec/aggregate_functions/aggregate_function_percentile.h @@ -383,6 +383,7 @@ struct PercentileState { inited_flag = true; vec_counts.resize(1); vec_quantile.resize(1); + check_quantile(q); vec_quantile[0] = q; } vec_counts[0].increment_batch(source); diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy index c64d33e1e82b81..26e9c63de67f4a 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy @@ -299,6 +299,17 @@ suite("test_aggregate_all_functions", "arrow_flight_sql") { assert("${ex}".contains("3000")) } + try { + sql "select id,percentile(non_nullable(level + 0.1), -1) from ${tableName_13} group by id order by id" + } catch (Exception ex) { + assert("${ex}".contains("-1")) + } + try { + sql "select id,percentile(non_nullable(level + 0.1), 3000) from ${tableName_13} group by id order by id" + } catch (Exception ex) { + assert("${ex}".contains("3000")) + } + sql "DROP TABLE IF EXISTS ${tableName_13}" From 190b794c1781257a70d0f0737c4fd214b14dcfe7 Mon Sep 17 00:00:00 2001 From: Mryange Date: Mon, 3 Mar 2025 19:58:28 +0800 Subject: [PATCH 2/2] upd case --- .../test_aggregate_all_functions.groovy | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy index 26e9c63de67f4a..e9683ffb92bbbc 100644 --- a/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy +++ b/regression-test/suites/query_p0/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy @@ -299,13 +299,24 @@ suite("test_aggregate_all_functions", "arrow_flight_sql") { assert("${ex}".contains("3000")) } + sql """ + drop table if exists percentile_input_no_nullable; + """ + sql """ + create table percentile_input_no_nullable(a int, b int not null) properties ("replication_num" = "1"); + """ + sql """ + insert into percentile_input_no_nullable values (10, 100), (20,200), (30, 300), (40, 400); + """ + try { - sql "select id,percentile(non_nullable(level + 0.1), -1) from ${tableName_13} group by id order by id" + sql " select percentile(b, -1) from percentile_input_no_nullable;" } catch (Exception ex) { assert("${ex}".contains("-1")) } + try { - sql "select id,percentile(non_nullable(level + 0.1), 3000) from ${tableName_13} group by id order by id" + sql " select percentile(b, 3000) from percentile_input_no_nullable;" } catch (Exception ex) { assert("${ex}".contains("3000")) }