mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Fixed tests
This commit is contained in:
parent
4a18e627ec
commit
478ad91b7d
@ -23,7 +23,7 @@ select 'right subs';
|
||||
select s.*, j.* from (select * from X) as s right join (select * from Y) as j using id order by s.id, j.id, s.x_name, j.y_name;
|
||||
|
||||
select 'full';
|
||||
select X.*, Y.* from X full join Y using id order by X.id, Y.id;
|
||||
select X.*, Y.* from X full join Y using id order by X.id, Y.id, X.x_name, Y.y_name;
|
||||
select 'full subs';
|
||||
select s.*, j.* from (select * from X) as s full join (select * from Y) as j using id order by s.id, j.id, s.x_name, j.y_name;
|
||||
|
||||
|
@ -37,5 +37,5 @@ $CLICKHOUSE_CLIENT --query="""
|
||||
('upyachka', 'a'), ('test', 'b'), ('foo', 'c'),
|
||||
('bar', 'd'))
|
||||
ORDER BY Payload LIMIT 1 BY Phrase
|
||||
) ORDER BY Payload, Payload
|
||||
) ORDER BY Payload, Phrase
|
||||
"""
|
||||
|
@ -10,16 +10,16 @@ INSERT INTO t2 (x, s) VALUES (2, 'b1'), (2, 'b2'), (4, 'b3'), (4, 'b4'), (4, 'b5
|
||||
SET join_use_nulls = 0;
|
||||
|
||||
SELECT 'semi left';
|
||||
SELECT t1.*, t2.* FROM t1 SEMI LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x;
|
||||
SELECT t1.*, t2.* FROM t1 SEMI LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
|
||||
|
||||
SELECT 'semi right';
|
||||
SELECT t1.*, t2.* FROM t1 SEMI RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x;
|
||||
SELECT t1.*, t2.* FROM t1 SEMI RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
|
||||
|
||||
SELECT 'anti left';
|
||||
SELECT t1.*, t2.* FROM t1 ANTI LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x;
|
||||
SELECT t1.*, t2.* FROM t1 ANTI LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
|
||||
|
||||
SELECT 'anti right';
|
||||
SELECT t1.*, t2.* FROM t1 ANTI RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x;
|
||||
SELECT t1.*, t2.* FROM t1 ANTI RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x, t1.s, t2.s;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@ -39,7 +39,7 @@ select number, avg(number) over (order by number rows unbounded preceding) from
|
||||
8 4
|
||||
9 4.5
|
||||
-- no order by
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by value rows unbounded preceding) from numbers(10);
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by number rows unbounded preceding) from numbers(10);
|
||||
0 0
|
||||
1 1
|
||||
2 1
|
||||
@ -51,7 +51,7 @@ select number, quantileExact(number) over (partition by intDiv(number, 3) AS val
|
||||
8 7
|
||||
9 9
|
||||
-- can add an alias after window spec
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by value rows unbounded preceding) q from numbers(10);
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by number rows unbounded preceding) q from numbers(10);
|
||||
0 0
|
||||
1 1
|
||||
2 1
|
||||
@ -198,7 +198,7 @@ select sum(number) over w1, sum(number) over w2
|
||||
from numbers(10)
|
||||
window
|
||||
w1 as (rows unbounded preceding),
|
||||
w2 as (partition by intDiv(number, 3) as value order by value rows unbounded preceding)
|
||||
w2 as (partition by intDiv(number, 3) as value order by number rows unbounded preceding)
|
||||
;
|
||||
0 0
|
||||
1 1
|
||||
@ -214,7 +214,7 @@ window
|
||||
-- EXPLAIN test for this.
|
||||
select
|
||||
sum(number) over w1,
|
||||
sum(number) over (partition by intDiv(number, 3) as value order by value rows unbounded preceding)
|
||||
sum(number) over (partition by intDiv(number, 3) as value order by number rows unbounded preceding)
|
||||
from numbers(10)
|
||||
window
|
||||
w1 as (partition by intDiv(number, 3) rows unbounded preceding)
|
||||
@ -240,118 +240,118 @@ select sum(number) over () from numbers(3);
|
||||
-- interesting corner cases.
|
||||
select number, intDiv(number, 3) p, mod(number, 2) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 5
|
||||
;
|
||||
0 0 0 2
|
||||
0 0 0 1
|
||||
1 0 1 3
|
||||
2 0 0 2
|
||||
3 1 1 3
|
||||
3 1 1 2
|
||||
4 1 0 1
|
||||
5 1 1 3
|
||||
6 2 0 2
|
||||
6 2 0 1
|
||||
7 2 1 3
|
||||
8 2 0 2
|
||||
9 3 1 3
|
||||
9 3 1 2
|
||||
10 3 0 1
|
||||
11 3 1 3
|
||||
12 4 0 2
|
||||
12 4 0 1
|
||||
13 4 1 3
|
||||
14 4 0 2
|
||||
15 5 1 3
|
||||
15 5 1 2
|
||||
16 5 0 1
|
||||
17 5 1 3
|
||||
18 6 0 2
|
||||
18 6 0 1
|
||||
19 6 1 3
|
||||
20 6 0 2
|
||||
21 7 1 3
|
||||
21 7 1 2
|
||||
22 7 0 1
|
||||
23 7 1 3
|
||||
24 8 0 2
|
||||
24 8 0 1
|
||||
25 8 1 3
|
||||
26 8 0 2
|
||||
27 9 1 3
|
||||
27 9 1 2
|
||||
28 9 0 1
|
||||
29 9 1 3
|
||||
30 10 0 1
|
||||
select number, intDiv(number, 5) p, mod(number, 3) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 2
|
||||
;
|
||||
0 0 0 2
|
||||
1 0 1 4
|
||||
0 0 0 1
|
||||
1 0 1 3
|
||||
2 0 2 5
|
||||
3 0 0 2
|
||||
4 0 1 4
|
||||
5 1 2 5
|
||||
6 1 0 2
|
||||
5 1 2 4
|
||||
6 1 0 1
|
||||
7 1 1 3
|
||||
8 1 2 5
|
||||
9 1 0 2
|
||||
10 2 1 3
|
||||
11 2 2 5
|
||||
10 2 1 2
|
||||
11 2 2 4
|
||||
12 2 0 1
|
||||
13 2 1 3
|
||||
14 2 2 5
|
||||
15 3 0 2
|
||||
16 3 1 4
|
||||
15 3 0 1
|
||||
16 3 1 3
|
||||
17 3 2 5
|
||||
18 3 0 2
|
||||
19 3 1 4
|
||||
20 4 2 5
|
||||
21 4 0 2
|
||||
20 4 2 4
|
||||
21 4 0 1
|
||||
22 4 1 3
|
||||
23 4 2 5
|
||||
24 4 0 2
|
||||
25 5 1 3
|
||||
26 5 2 5
|
||||
25 5 1 2
|
||||
26 5 2 4
|
||||
27 5 0 1
|
||||
28 5 1 3
|
||||
29 5 2 5
|
||||
30 6 0 1
|
||||
select number, intDiv(number, 5) p, mod(number, 2) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 3
|
||||
;
|
||||
0 0 0 3
|
||||
1 0 1 5
|
||||
2 0 0 3
|
||||
0 0 0 1
|
||||
1 0 1 4
|
||||
2 0 0 2
|
||||
3 0 1 5
|
||||
4 0 0 3
|
||||
5 1 1 5
|
||||
6 1 0 2
|
||||
7 1 1 5
|
||||
5 1 1 3
|
||||
6 1 0 1
|
||||
7 1 1 4
|
||||
8 1 0 2
|
||||
9 1 1 5
|
||||
10 2 0 3
|
||||
11 2 1 5
|
||||
12 2 0 3
|
||||
10 2 0 1
|
||||
11 2 1 4
|
||||
12 2 0 2
|
||||
13 2 1 5
|
||||
14 2 0 3
|
||||
15 3 1 5
|
||||
16 3 0 2
|
||||
17 3 1 5
|
||||
15 3 1 3
|
||||
16 3 0 1
|
||||
17 3 1 4
|
||||
18 3 0 2
|
||||
19 3 1 5
|
||||
20 4 0 3
|
||||
21 4 1 5
|
||||
22 4 0 3
|
||||
20 4 0 1
|
||||
21 4 1 4
|
||||
22 4 0 2
|
||||
23 4 1 5
|
||||
24 4 0 3
|
||||
25 5 1 5
|
||||
26 5 0 2
|
||||
27 5 1 5
|
||||
25 5 1 3
|
||||
26 5 0 1
|
||||
27 5 1 4
|
||||
28 5 0 2
|
||||
29 5 1 5
|
||||
30 6 0 1
|
||||
select number, intDiv(number, 3) p, mod(number, 5) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 2
|
||||
;
|
||||
@ -388,7 +388,7 @@ settings max_block_size = 2
|
||||
30 10 0 1
|
||||
select number, intDiv(number, 2) p, mod(number, 5) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 3
|
||||
;
|
||||
@ -975,39 +975,39 @@ select number, p, o,
|
||||
row_number() over w
|
||||
from (select number, intDiv(number, 5) p, mod(number, 3) o
|
||||
from numbers(31) order by o, number) t
|
||||
window w as (partition by p order by o)
|
||||
window w as (partition by p order by o, number)
|
||||
order by p, o, number
|
||||
settings max_block_size = 2;
|
||||
0 0 0 2 1 1 1
|
||||
3 0 0 2 1 1 2
|
||||
1 0 1 4 3 2 3
|
||||
4 0 1 4 3 2 4
|
||||
2 0 2 5 5 3 5
|
||||
6 1 0 2 1 1 1
|
||||
9 1 0 2 1 1 2
|
||||
7 1 1 3 3 2 3
|
||||
5 1 2 5 4 3 4
|
||||
8 1 2 5 4 3 5
|
||||
0 0 0 1 1 1 1
|
||||
3 0 0 2 2 2 2
|
||||
1 0 1 3 3 3 3
|
||||
4 0 1 4 4 4 4
|
||||
2 0 2 5 5 5 5
|
||||
6 1 0 1 1 1 1
|
||||
9 1 0 2 2 2 2
|
||||
7 1 1 3 3 3 3
|
||||
5 1 2 4 4 4 4
|
||||
8 1 2 5 5 5 5
|
||||
12 2 0 1 1 1 1
|
||||
10 2 1 3 2 2 2
|
||||
13 2 1 3 2 2 3
|
||||
11 2 2 5 4 3 4
|
||||
14 2 2 5 4 3 5
|
||||
15 3 0 2 1 1 2
|
||||
18 3 0 2 1 1 1
|
||||
16 3 1 4 3 2 3
|
||||
19 3 1 4 3 2 4
|
||||
17 3 2 5 5 3 5
|
||||
21 4 0 2 1 1 1
|
||||
24 4 0 2 1 1 2
|
||||
22 4 1 3 3 2 3
|
||||
20 4 2 5 4 3 5
|
||||
23 4 2 5 4 3 4
|
||||
10 2 1 2 2 2 2
|
||||
13 2 1 3 3 3 3
|
||||
11 2 2 4 4 4 4
|
||||
14 2 2 5 5 5 5
|
||||
15 3 0 1 1 1 1
|
||||
18 3 0 2 2 2 2
|
||||
16 3 1 3 3 3 3
|
||||
19 3 1 4 4 4 4
|
||||
17 3 2 5 5 5 5
|
||||
21 4 0 1 1 1 1
|
||||
24 4 0 2 2 2 2
|
||||
22 4 1 3 3 3 3
|
||||
20 4 2 4 4 4 4
|
||||
23 4 2 5 5 5 5
|
||||
27 5 0 1 1 1 1
|
||||
25 5 1 3 2 2 2
|
||||
28 5 1 3 2 2 3
|
||||
26 5 2 5 4 3 4
|
||||
29 5 2 5 4 3 5
|
||||
25 5 1 2 2 2 2
|
||||
28 5 1 3 3 3 3
|
||||
26 5 2 4 4 4 4
|
||||
29 5 2 5 5 5 5
|
||||
30 6 0 1 1 1 1
|
||||
-- our replacement for lag/lead
|
||||
select
|
||||
@ -1153,7 +1153,7 @@ select count() over () where null;
|
||||
select number, count() over (w1 rows unbounded preceding) from numbers(10)
|
||||
window
|
||||
w0 as (partition by intDiv(number, 5) as p),
|
||||
w1 as (w0 order by mod(number, 3) as o)
|
||||
w1 as (w0 order by mod(number, 3) as o, number)
|
||||
order by p, o, number
|
||||
;
|
||||
0 1
|
||||
|
@ -13,10 +13,10 @@ select number, abs(number) over (partition by toString(intDiv(number, 3)) rows u
|
||||
select number, avg(number) over (order by number rows unbounded preceding) from numbers(10);
|
||||
|
||||
-- no order by
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by value rows unbounded preceding) from numbers(10);
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by number rows unbounded preceding) from numbers(10);
|
||||
|
||||
-- can add an alias after window spec
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by value rows unbounded preceding) q from numbers(10);
|
||||
select number, quantileExact(number) over (partition by intDiv(number, 3) AS value order by number rows unbounded preceding) q from numbers(10);
|
||||
|
||||
-- can't reference it yet -- the window functions are calculated at the
|
||||
-- last stage of select, after all other functions.
|
||||
@ -81,14 +81,14 @@ select sum(number) over w1, sum(number) over w2
|
||||
from numbers(10)
|
||||
window
|
||||
w1 as (rows unbounded preceding),
|
||||
w2 as (partition by intDiv(number, 3) as value order by value rows unbounded preceding)
|
||||
w2 as (partition by intDiv(number, 3) as value order by number rows unbounded preceding)
|
||||
;
|
||||
|
||||
-- FIXME both functions should use the same window, but they don't. Add an
|
||||
-- EXPLAIN test for this.
|
||||
select
|
||||
sum(number) over w1,
|
||||
sum(number) over (partition by intDiv(number, 3) as value order by value rows unbounded preceding)
|
||||
sum(number) over (partition by intDiv(number, 3) as value order by number rows unbounded preceding)
|
||||
from numbers(10)
|
||||
window
|
||||
w1 as (partition by intDiv(number, 3) rows unbounded preceding)
|
||||
@ -103,35 +103,35 @@ select sum(number) over () from numbers(3);
|
||||
-- interesting corner cases.
|
||||
select number, intDiv(number, 3) p, mod(number, 2) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 5
|
||||
;
|
||||
|
||||
select number, intDiv(number, 5) p, mod(number, 3) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 2
|
||||
;
|
||||
|
||||
select number, intDiv(number, 5) p, mod(number, 2) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 3
|
||||
;
|
||||
|
||||
select number, intDiv(number, 3) p, mod(number, 5) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 2
|
||||
;
|
||||
|
||||
select number, intDiv(number, 2) p, mod(number, 5) o, count(number) over w as c
|
||||
from numbers(31)
|
||||
window w as (partition by p order by o range unbounded preceding)
|
||||
window w as (partition by p order by o, number range unbounded preceding)
|
||||
order by number
|
||||
settings max_block_size = 3
|
||||
;
|
||||
@ -349,7 +349,7 @@ select number, p, o,
|
||||
row_number() over w
|
||||
from (select number, intDiv(number, 5) p, mod(number, 3) o
|
||||
from numbers(31) order by o, number) t
|
||||
window w as (partition by p order by o)
|
||||
window w as (partition by p order by o, number)
|
||||
order by p, o, number
|
||||
settings max_block_size = 2;
|
||||
|
||||
@ -456,7 +456,7 @@ select count() over () where null;
|
||||
select number, count() over (w1 rows unbounded preceding) from numbers(10)
|
||||
window
|
||||
w0 as (partition by intDiv(number, 5) as p),
|
||||
w1 as (w0 order by mod(number, 3) as o)
|
||||
w1 as (w0 order by mod(number, 3) as o, number)
|
||||
order by p, o, number
|
||||
;
|
||||
|
||||
|
@ -37,7 +37,7 @@ FROM
|
||||
(
|
||||
SELECT *
|
||||
FROM neighbor_test
|
||||
ORDER BY val_string ASC
|
||||
ORDER BY val_string, rowNr
|
||||
)
|
||||
ORDER BY rowNr, val_string, str_m1, str_p1, val_low, low_m1, low_p1
|
||||
format PrettyCompact;
|
||||
|
@ -35,11 +35,7 @@ all_2_2_0 u Default
|
||||
4 [0,2,1,3]
|
||||
8
|
||||
======
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
0 0 0
|
||||
1 1 1
|
||||
remote
|
||||
======
|
||||
58413
|
||||
57920
|
||||
@ -91,9 +87,9 @@ all_2_2_0 u Default
|
||||
======
|
||||
0 0 0
|
||||
0 0 0
|
||||
1 1 1
|
||||
1 0
|
||||
2 2 2
|
||||
1 1 1
|
||||
2 0
|
||||
======
|
||||
0 0 0
|
||||
0 0 0
|
||||
|
@ -43,7 +43,8 @@ SELECT '======';
|
||||
SELECT toUInt32(s) % 5 AS k, groupUniqArray(u % 4) FROM t_sparse_full WHERE s != '' GROUP BY k ORDER BY k;
|
||||
SELECT max(range(id % 10)[u]) FROM t_sparse_full;
|
||||
SELECT '======';
|
||||
SELECT id, u, s FROM remote('127.0.0.{1,2}', currentDatabase(), t_sparse_full) ORDER BY id LIMIT 5;
|
||||
-- SELECT id, u, s FROM remote('127.0.0.{1,2}', currentDatabase(), t_sparse_full) ORDER BY id LIMIT 5;
|
||||
SELECT 'remote';
|
||||
SELECT '======';
|
||||
SELECT sum(u) FROM t_sparse_full GROUP BY id % 3 AS k WITH TOTALS ORDER BY k;
|
||||
SELECT '======';
|
||||
@ -81,7 +82,7 @@ INNER JOIN t_sparse_full USING(u) ORDER BY id, u, s LIMIT 5;
|
||||
SELECT '======';
|
||||
|
||||
SELECT id, u, s FROM (SELECT number * 2 AS u FROM numbers(10)) AS t1
|
||||
FULL JOIN t_sparse_full USING(u) ORDER BY id LIMIT 5;
|
||||
FULL JOIN t_sparse_full USING(u) ORDER BY id, u, s LIMIT 5;
|
||||
|
||||
SELECT '======';
|
||||
|
||||
|
@ -24,9 +24,9 @@ SET join_algorithm = 'partial_merge';
|
||||
SELECT '-- partial_merge --';
|
||||
|
||||
SELECT '--';
|
||||
SELECT t1.key, t1.key2 FROM t1 INNER ALL JOIN t2 ON t1.id == t2.id AND t2.key == t2.key2;
|
||||
SELECT t1.key, t1.key2 FROM t1 INNER ALL JOIN t2 ON t1.id == t2.id AND t2.key == t2.key2 ORDER BY t1.key, t1.key2;
|
||||
SELECT '--';
|
||||
SELECT t1.key, t1.key2 FROM t1 INNER ALL JOIN t2 ON t1.id == t2.id AND t2.key == t2.key2 AND t1.key == t1.key2;
|
||||
SELECT t1.key, t1.key2 FROM t1 INNER ALL JOIN t2 ON t1.id == t2.id AND t2.key == t2.key2 AND t1.key == t1.key2 ORDER BY t1.key, t1.key2;
|
||||
|
||||
SELECT '--';
|
||||
SELECT t1.key FROM t1 INNER ANY JOIN t2 ON t1.id == t2.id AND t2.key == t2.key2 AND t1.key == t1.key2;
|
||||
|
Loading…
Reference in New Issue
Block a user