Fix non-deterministic queries

This commit is contained in:
Igor Nikonov 2022-08-01 10:40:18 +00:00
parent f6739c6c98
commit 914cf8eb4d
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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);