From d26f9e4022ae119d03b612a263f110f637cce93d Mon Sep 17 00:00:00 2001 From: Igor Nikonov Date: Tue, 23 May 2023 10:24:06 +0000 Subject: [PATCH] Test with DESC order in sorting prefix --- ...2730_with_fill_by_sorting_prefix.reference | 88 +++++++++++++++++++ .../02730_with_fill_by_sorting_prefix.sql | 14 +++ 2 files changed, 102 insertions(+) diff --git a/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.reference b/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.reference index 5ec4245b478..260f08027f1 100644 --- a/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.reference +++ b/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.reference @@ -55,6 +55,8 @@ select * from ts order by sensor_id, timestamp with fill step 1 settings max_blo 5 1 1 5 2 0 5 3 1 +-- FROM and TO +-- ASC order in sorting prefix select * from ts order by sensor_id, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999); 1 6 9999 1 7 9999 @@ -84,7 +86,37 @@ select * from ts order by sensor_id, timestamp with fill from 6 to 10 step 1 int 3 7 1 5 1 1 5 3 1 +-- DESC order in sorting prefix +select * from ts order by sensor_id DESC, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999); +5 1 1 +5 3 1 +5 6 9999 +5 7 9999 +5 8 9999 +5 9 9999 +3 5 1 +3 6 9999 +3 7 1 +3 8 9999 +3 9 9999 +1 6 9999 +1 7 9999 +1 8 9999 +1 9 9999 +1 10 1 +1 12 1 +select * from ts order by sensor_id DESC, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; +5 1 1 +5 3 1 +3 5 1 +0 6 9999 +3 7 1 +0 8 9999 +0 9 9999 +1 10 1 +1 12 1 -- without TO +-- ASC order in sorting prefix select * from ts order by sensor_id, timestamp with fill from 6 step 1 interpolate (value as 9999); 1 6 9999 1 7 9999 @@ -110,7 +142,33 @@ select * from ts order by sensor_id, timestamp with fill from 6 step 1 interpola 3 7 1 5 1 1 5 3 1 +-- DESC order in sorting prefix +select * from ts order by sensor_id DESC, timestamp with fill from 6 step 1 interpolate (value as 9999); +5 1 1 +5 3 1 +3 5 1 +3 6 9999 +3 7 1 +1 6 9999 +1 7 9999 +1 8 9999 +1 9 9999 +1 10 1 +1 11 9999 +1 12 1 +select * from ts order by sensor_id DESC, timestamp with fill from 6 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; +5 1 1 +5 3 1 +3 5 1 +0 6 9999 +3 7 1 +0 8 9999 +0 9 9999 +1 10 1 +0 11 9999 +1 12 1 -- without FROM +-- ASC order in sorting prefix select * from ts order by sensor_id, timestamp with fill to 10 step 1 interpolate (value as 9999); 1 10 1 1 12 1 @@ -135,5 +193,35 @@ select * from ts order by sensor_id, timestamp with fill to 10 step 1 interpolat 3 7 1 5 1 1 5 3 1 +-- DESC order in sorting prefix +select * from ts order by sensor_id DESC, timestamp with fill to 10 step 1 interpolate (value as 9999); +5 1 1 +5 2 9999 +5 3 1 +5 4 9999 +5 5 9999 +5 6 9999 +5 7 9999 +5 8 9999 +5 9 9999 +3 5 1 +3 6 9999 +3 7 1 +3 8 9999 +3 9 9999 +1 10 1 +1 12 1 +select * from ts order by sensor_id DESC, timestamp with fill to 10 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; +5 1 1 +0 2 9999 +5 3 1 +0 4 9999 +3 5 1 +0 6 9999 +3 7 1 +0 8 9999 +0 9 9999 +1 10 1 +1 12 1 -- checking that sorting prefix columns can't be used in INTERPOLATE SELECT * FROM ts ORDER BY sensor_id, value, timestamp WITH FILL FROM 6 TO 10 INTERPOLATE ( value AS 1 ); -- { serverError INVALID_WITH_FILL_EXPRESSION } diff --git a/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.sql b/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.sql index dd0f06e5c8c..e2f1ce29d5c 100644 --- a/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.sql +++ b/tests/queries/0_stateless/02730_with_fill_by_sorting_prefix.sql @@ -31,16 +31,30 @@ insert into ts VALUES (1, 10, 1), (1, 12, 1), (3, 5, 1); insert into ts VALUES (3, 7, 1), (5, 1, 1), (5, 3, 1); select * from ts order by sensor_id, timestamp with fill step 1 settings max_block_size=3; +-- FROM and TO +-- ASC order in sorting prefix select * from ts order by sensor_id, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999); select * from ts order by sensor_id, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; +-- DESC order in sorting prefix +select * from ts order by sensor_id DESC, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999); +select * from ts order by sensor_id DESC, timestamp with fill from 6 to 10 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; + -- without TO +-- ASC order in sorting prefix select * from ts order by sensor_id, timestamp with fill from 6 step 1 interpolate (value as 9999); select * from ts order by sensor_id, timestamp with fill from 6 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; +-- DESC order in sorting prefix +select * from ts order by sensor_id DESC, timestamp with fill from 6 step 1 interpolate (value as 9999); +select * from ts order by sensor_id DESC, timestamp with fill from 6 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; -- without FROM +-- ASC order in sorting prefix select * from ts order by sensor_id, timestamp with fill to 10 step 1 interpolate (value as 9999); select * from ts order by sensor_id, timestamp with fill to 10 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; +-- DESC order in sorting prefix +select * from ts order by sensor_id DESC, timestamp with fill to 10 step 1 interpolate (value as 9999); +select * from ts order by sensor_id DESC, timestamp with fill to 10 step 1 interpolate (value as 9999) settings use_with_fill_by_sorting_prefix=0; -- checking that sorting prefix columns can't be used in INTERPOLATE SELECT * FROM ts ORDER BY sensor_id, value, timestamp WITH FILL FROM 6 TO 10 INTERPOLATE ( value AS 1 ); -- { serverError INVALID_WITH_FILL_EXPRESSION }