diff --git a/tests/queries/0_stateless/02317_distinct_in_order_optimization.reference b/tests/queries/0_stateless/02317_distinct_in_order_optimization.reference index efc9e28bcce..d827dc33838 100644 --- a/tests/queries/0_stateless/02317_distinct_in_order_optimization.reference +++ b/tests/queries/0_stateless/02317_distinct_in_order_optimization.reference @@ -85,11 +85,11 @@ select distinct 1 as x, 2 as y from distinct_in_order order by x; 1 2 select distinct 1 as x, 2 as y from distinct_in_order order by x, y; 1 2 -select distinct a, 1 as x from distinct_in_order order by x; +select a, x from (select distinct a, 1 as x from distinct_in_order order by x) order by a; 0 1 select distinct a, 1 as x, 2 as y from distinct_in_order order by a; 0 1 2 -select distinct a, b, 1 as x, 2 as y from distinct_in_order order by a; +select a, b, x, y from(select distinct a, b, 1 as x, 2 as y from distinct_in_order order by a) order by a, b; 0 0 1 2 0 1 1 2 0 2 1 2 @@ -97,10 +97,10 @@ select distinct a, b, 1 as x, 2 as y from distinct_in_order order by a; 0 4 1 2 select distinct x, y from (select 1 as x, 2 as y from distinct_in_order order by x) order by y; 1 2 -select distinct a, b, x, y from (select a, b, 1 as x, 2 as y from distinct_in_order order by a) order by b; +select distinct a, b, x, y from (select a, b, 1 as x, 2 as y from distinct_in_order order by a) order by a, b; 0 0 1 2 0 1 1 2 0 2 1 2 0 3 1 2 0 4 1 2 --- check that distinct in order has the same result as ordinary distinct +-- check that distinct in order returns the same result as ordinary distinct diff --git a/tests/queries/0_stateless/02317_distinct_in_order_optimization.sql b/tests/queries/0_stateless/02317_distinct_in_order_optimization.sql index 7a70e2ef873..0fb3766edb4 100644 --- a/tests/queries/0_stateless/02317_distinct_in_order_optimization.sql +++ b/tests/queries/0_stateless/02317_distinct_in_order_optimization.sql @@ -48,16 +48,16 @@ select '-- distinct with constants columns'; select distinct 1 as x, 2 as y from distinct_in_order; select distinct 1 as x, 2 as y from distinct_in_order order by x; select distinct 1 as x, 2 as y from distinct_in_order order by x, y; -select distinct a, 1 as x from distinct_in_order order by x; +select a, x from (select distinct a, 1 as x from distinct_in_order order by x) order by a; select distinct a, 1 as x, 2 as y from distinct_in_order order by a; -select distinct a, b, 1 as x, 2 as y from distinct_in_order order by a; +select a, b, x, y from(select distinct a, b, 1 as x, 2 as y from distinct_in_order order by a) order by a, b; select distinct x, y from (select 1 as x, 2 as y from distinct_in_order order by x) order by y; -select distinct a, b, x, y from (select a, b, 1 as x, 2 as y from distinct_in_order order by a) order by b; +select distinct a, b, x, y from (select a, b, 1 as x, 2 as y from distinct_in_order order by a) order by a, b; -- { echoOff } drop table if exists distinct_in_order sync; -select '-- check that distinct in order has the same result as ordinary distinct'; +select '-- check that distinct in order returns the same result as ordinary distinct'; drop table if exists distinct_cardinality_low sync; CREATE TABLE distinct_cardinality_low (low UInt64, medium UInt64, high UInt64) ENGINE MergeTree() ORDER BY (low, medium); INSERT INTO distinct_cardinality_low SELECT number % 1e1, number % 1e2, number % 1e3 FROM numbers_mt(1e4);