From d3062924c8e64358400c2e7ca778c5166017fa87 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 23 Mar 2019 05:47:45 +0300 Subject: [PATCH] Added proper test for merging of "histogram" aggregate function states --- .../00919_histogram_merge.reference | 6 ++++ .../0_stateless/00919_histogram_merge.sql | 2 ++ .../00151_histogram_merge.reference | 2 -- .../1_stateful/00151_histogram_merge.sql | 34 ------------------- 4 files changed, 8 insertions(+), 36 deletions(-) create mode 100644 dbms/tests/queries/0_stateless/00919_histogram_merge.reference create mode 100644 dbms/tests/queries/0_stateless/00919_histogram_merge.sql delete mode 100644 dbms/tests/queries/1_stateful/00151_histogram_merge.reference delete mode 100644 dbms/tests/queries/1_stateful/00151_histogram_merge.sql diff --git a/dbms/tests/queries/0_stateless/00919_histogram_merge.reference b/dbms/tests/queries/0_stateless/00919_histogram_merge.reference new file mode 100644 index 00000000000..8f5c9f61c0d --- /dev/null +++ b/dbms/tests/queries/0_stateless/00919_histogram_merge.reference @@ -0,0 +1,6 @@ +0 55 101 +55 117 97 +117 199 92 +0 55 101 +55 117 97 +117 199 92 diff --git a/dbms/tests/queries/0_stateless/00919_histogram_merge.sql b/dbms/tests/queries/0_stateless/00919_histogram_merge.sql new file mode 100644 index 00000000000..5dec4374092 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00919_histogram_merge.sql @@ -0,0 +1,2 @@ +WITH arrayJoin(finalizeAggregation((SELECT histogramState(3)(number) FROM numbers(10, 190)) + (SELECT histogramState(3)(number) FROM numbers(0, 100)))) AS hist SELECT round(hist.1) AS l, round(hist.2) AS r, round(hist.3) AS cnt; +WITH arrayJoin(finalizeAggregation((SELECT histogramState(3)(number) FROM numbers(0, 100)) + (SELECT histogramState(3)(number) FROM numbers(10, 190)))) AS hist SELECT round(hist.1) AS l, round(hist.2) AS r, round(hist.3) AS cnt; diff --git a/dbms/tests/queries/1_stateful/00151_histogram_merge.reference b/dbms/tests/queries/1_stateful/00151_histogram_merge.reference deleted file mode 100644 index 72d223a3248..00000000000 --- a/dbms/tests/queries/1_stateful/00151_histogram_merge.reference +++ /dev/null @@ -1,2 +0,0 @@ -199 -199 diff --git a/dbms/tests/queries/1_stateful/00151_histogram_merge.sql b/dbms/tests/queries/1_stateful/00151_histogram_merge.sql deleted file mode 100644 index 0e8347817ff..00000000000 --- a/dbms/tests/queries/1_stateful/00151_histogram_merge.sql +++ /dev/null @@ -1,34 +0,0 @@ -create table test.test_histogram (a Int32) -ENGINE = Memory - ---127.0.0.1 -insert into test.test_histogram (a) SELECT * FROM numbers(10, 190) - ---127.0.0.2 -insert into test.test_histogram (a) SELECT * FROM numbers(0, 100) - - ---make sure upper_bound=199 ---when merging AggregationState in both 1,2 and 2,1 order - -with -histogram(3)(a) AS hst, -arrayJoin(hst) AS hst_array -select -round(hst_array.2) AS upper_bound -from remote('127.0.0.{1,2}', 'test', 'test_histogram') -having upper_bound = 199 -order by upper_bound desc -limit 1 - -with -histogram(3)(a) AS hst, -arrayJoin(hst) AS hst_array -select -round(hst_array.2) AS upper_bound -from remote('127.0.0.{2,1}', 'test', 'test_histogram') -having upper_bound = 199 -order by upper_bound desc -limit 1 - -drop table test.test_histogram