From 4b9a1390ff9e463e2f87d655150cd2d1b48d0a64 Mon Sep 17 00:00:00 2001 From: sundy-li <543950155@qq.com> Date: Mon, 13 Aug 2018 17:28:49 +0800 Subject: [PATCH] add quantile tests --- .../00181_aggregate_functions_statistics.reference | 8 ++++++++ .../00181_aggregate_functions_statistics.sql | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.reference b/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.reference index 4338ddbb043..b4a55ae0d66 100644 --- a/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.reference +++ b/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.reference @@ -19,3 +19,11 @@ nan nan nan 0 +----quantile---- +45 +0 +nan +nan +nan +nan +nan diff --git a/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.sql b/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.sql index dc82c991918..589e5d92aca 100644 --- a/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.sql +++ b/dbms/tests/queries/0_stateless/00181_aggregate_functions_statistics.sql @@ -139,4 +139,17 @@ SELECT corr(x_value, y_value) FROM (SELECT x_value, y_value FROM test.series LIM SELECT round(abs(corr(x_value, y_value) - covarPop(x_value, y_value) / (stddevPop(x_value) * stddevPop(y_value))), 6) FROM test.series; +/* quantile AND quantileExact */ +SELECT '----quantile----'; + +SELECT quantileExactIf(number, number > 0) FROM numbers(90); + +SELECT quantileExactIf(number, number > 100) FROM numbers(90); +SELECT quantileExactIf(toFloat32(number) , number > 100) FROM numbers(90); +SELECT quantileExactIf(toFloat64(number) , number > 100) FROM numbers(90); + +SELECT quantileIf(number, number > 100) FROM numbers(90); +SELECT quantileIf(toFloat32(number) , number > 100) FROM numbers(90); +SELECT quantileIf(toFloat64(number) , number > 100) FROM numbers(90); + DROP TABLE test.series;