From 1ebc5377f8ba32f8a1b7eb32994371f703b335df Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Jun 2019 09:53:23 -0400 Subject: [PATCH] movingSum fix test for blocks order --- .../0_stateless/00953_moving_sum.reference | 28 +++++++++++++++---- .../queries/0_stateless/00953_moving_sum.sql | 10 ++++--- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/dbms/tests/queries/0_stateless/00953_moving_sum.reference b/dbms/tests/queries/0_stateless/00953_moving_sum.reference index da8b0e1f53e..183f49f3c20 100644 --- a/dbms/tests/queries/0_stateless/00953_moving_sum.reference +++ b/dbms/tests/queries/0_stateless/00953_moving_sum.reference @@ -1,3 +1,19 @@ +k dt v +b 2001-02-03 01:00:00 5 +b 2001-02-03 01:00:01 6 +b 2001-02-03 01:00:02 7 +b 2001-02-03 01:00:03 8 +b 2001-02-03 01:00:04 9 +a 2001-02-03 00:00:00 0 +a 2001-02-03 00:00:01 1 +a 2001-02-03 00:00:02 2 +a 2001-02-03 00:00:03 3 +a 2001-02-03 00:00:04 4 +b 2001-02-03 00:00:00 0 +b 2001-02-03 00:00:01 1 +b 2001-02-03 00:00:02 2 +b 2001-02-03 00:00:03 3 +b 2001-02-03 00:00:04 4 k movingSum(v) String Array(UInt64) a [0,1,3,6,10] @@ -7,10 +23,10 @@ String Array(UInt64) a [0,1,3,6,9] b [0,1,3,6,9,12,15,18,21,24] k movingSum(v) -String Array(Decimal(18, 2)) -a [0.00,1.00,3.00,6.00,10.00] -b [0.00,1.00,3.00,6.00,10.00,15.00,21.00,28.00,36.00,45.00] +String Array(UInt64) +a [0,1,3,6,10] +b [0,1,3,6,10,15,21,28,36,45] k movingSum(v) -String Array(Decimal(18, 2)) -a [0.00,1.00,3.00,6.00,10.00] -b [0.00,1.00,3.00,6.00,10.00,15.00,21.00,28.00,36.00,45.00] +String Array(UInt64) +a [0,1,3,6,10] +b [0,1,3,6,10,15,21,28,36,45] diff --git a/dbms/tests/queries/0_stateless/00953_moving_sum.sql b/dbms/tests/queries/0_stateless/00953_moving_sum.sql index 0da87b4de8b..a22b1254218 100644 --- a/dbms/tests/queries/0_stateless/00953_moving_sum.sql +++ b/dbms/tests/queries/0_stateless/00953_moving_sum.sql @@ -22,15 +22,17 @@ INSERT INTO moving_sum_num FROM system.numbers LIMIT 5; -SELECT k, movingSum(v) FROM moving_sum_num GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; -SELECT k, movingSum(3)(v) FROM moving_sum_num GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; +SELECT * FROM moving_sum_num FORMAT TabSeparatedWithNames; + +SELECT k, movingSum(v) FROM (SELECT * FROM moving_sum_num ORDER BY k, dt) GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; +SELECT k, movingSum(3)(v) FROM (SELECT * FROM moving_sum_num ORDER BY k, dt) GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; CREATE TABLE moving_sum_dec ENGINE = Memory AS SELECT k, dt, toDecimal64(v, 2) as v FROM moving_sum_num; -SELECT k, movingSum(v) FROM moving_sum_dec GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; -SELECT k, movingSum(v) FROM moving_sum_dec GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; +SELECT k, movingSum(v) FROM (SELECT * FROM moving_sum_num ORDER BY k, dt) GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; +SELECT k, movingSum(v) FROM (SELECT * FROM moving_sum_num ORDER BY k, dt) GROUP BY k ORDER BY k FORMAT TabSeparatedWithNamesAndTypes; DROP TABLE moving_sum_dec; DROP TABLE moving_sum_num;