mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Add tests to 01720_join_implicit_cast - switch, use_nulls
This commit is contained in:
parent
9b79ab2ac0
commit
cd7d9584bd
@ -200,6 +200,136 @@
|
||||
1
|
||||
1
|
||||
1
|
||||
--- switch ---
|
||||
- full -
|
||||
-4 0 196
|
||||
-3 0 197
|
||||
-2 0 198
|
||||
-1 0 199
|
||||
0 0 200
|
||||
1 101 201
|
||||
2 102 202
|
||||
3 103 203
|
||||
4 104 204
|
||||
5 105 205
|
||||
6 106 \N
|
||||
7 107 \N
|
||||
8 108 \N
|
||||
9 109 \N
|
||||
10 110 \N
|
||||
- left -
|
||||
1 101 201
|
||||
2 102 202
|
||||
3 103 203
|
||||
4 104 204
|
||||
5 105 205
|
||||
6 106 \N
|
||||
7 107 \N
|
||||
8 108 \N
|
||||
9 109 \N
|
||||
10 110 \N
|
||||
- right -
|
||||
-4 0 196
|
||||
-3 0 197
|
||||
-2 0 198
|
||||
-1 0 199
|
||||
0 0 200
|
||||
1 101 201
|
||||
2 102 202
|
||||
3 103 203
|
||||
4 104 204
|
||||
5 105 205
|
||||
- inner -
|
||||
1 101 201
|
||||
2 102 202
|
||||
3 103 203
|
||||
4 104 204
|
||||
5 105 205
|
||||
- full -
|
||||
0 0 -4
|
||||
0 0 -3
|
||||
0 0 -2
|
||||
0 0 -1
|
||||
0 0 0
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
6 6 0
|
||||
7 7 0
|
||||
8 8 0
|
||||
9 9 0
|
||||
10 10 0
|
||||
- left -
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
6 6 0
|
||||
7 7 0
|
||||
8 8 0
|
||||
9 9 0
|
||||
10 10 0
|
||||
- right -
|
||||
0 0 -4
|
||||
0 0 -3
|
||||
0 0 -2
|
||||
0 0 -1
|
||||
0 0 0
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
- inner -
|
||||
1 1 1
|
||||
2 2 2
|
||||
3 3 3
|
||||
4 4 4
|
||||
5 5 5
|
||||
- agg -
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
- types -
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
--- join use nulls ---
|
||||
- full -
|
||||
-4 \N 196
|
||||
-3 \N 197
|
||||
-2 \N 198
|
||||
-1 \N 199
|
||||
0 \N 200
|
||||
1 101 201
|
||||
2 102 202
|
||||
3 103 203
|
||||
4 104 204
|
||||
5 105 205
|
||||
6 106 \N
|
||||
7 107 \N
|
||||
8 108 \N
|
||||
9 109 \N
|
||||
10 110 \N
|
||||
- right -
|
||||
-4 \N 196
|
||||
-3 \N 197
|
||||
-2 \N 198
|
||||
-1 \N 199
|
||||
0 \N 200
|
||||
1 101 201
|
||||
2 102 202
|
||||
3 103 203
|
||||
4 104 204
|
||||
5 105 205
|
||||
---
|
||||
--- hash ---
|
||||
- full -
|
||||
1 1
|
@ -94,9 +94,70 @@ SELECT * FROM t1 LEFT JOIN t2 ON(t1.a == t2.a) ORDER BY (a); -- { serverError 53
|
||||
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (a); -- { serverError 53 }
|
||||
SELECT * FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (a); -- { serverError 53 }
|
||||
|
||||
|
||||
SELECT '--- switch ---';
|
||||
|
||||
SET join_algorithm = 'auto';
|
||||
SET max_bytes_in_join = 100;
|
||||
|
||||
SELECT '- full -';
|
||||
SELECT a, b, t2.b FROM t1 FULL JOIN t2 USING (a) ORDER BY (a);
|
||||
SELECT '- left -';
|
||||
SELECT a, b, t2.b FROM t1 LEFT JOIN t2 USING (a) ORDER BY (a);
|
||||
SELECT '- right -';
|
||||
SELECT a, b, t2.b FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (a);
|
||||
SELECT '- inner -';
|
||||
SELECT a, b, t2.b FROM t1 INNER JOIN t2 USING (a) ORDER BY (a);
|
||||
|
||||
|
||||
SELECT '- full -';
|
||||
SELECT a, t1.a, t2.a FROM t1 FULL JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
|
||||
SELECT '- left -';
|
||||
SELECT a, t1.a, t2.a FROM t1 LEFT JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
|
||||
SELECT '- right -';
|
||||
SELECT a, t1.a, t2.a FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
|
||||
SELECT '- inner -';
|
||||
SELECT a, t1.a, t2.a FROM t1 INNER JOIN t2 USING (a) ORDER BY (t1.a, t2.a);
|
||||
|
||||
select '- agg -';
|
||||
SELECT sum(a) == 7 FROM t1 FULL JOIN t2 USING (a) WHERE b > 102 AND t2.b <= 204;
|
||||
SELECT sum(a) == 7 FROM t1 INNER JOIN t2 USING (a) WHERE b > 102 AND t2.b <= 204;
|
||||
|
||||
SELECT sum(b) = 103 FROM t1 LEFT JOIN t2 USING (a) WHERE b > 102 AND t2.b < 204;
|
||||
SELECT sum(t2.b) = 203 FROM t1 RIGHT JOIN t2 USING (a) WHERE b > 102 AND t2.b < 204;
|
||||
|
||||
SELECT '- types -';
|
||||
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 FULL JOIN t2 USING (a);
|
||||
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 LEFT JOIN t2 USING (a);
|
||||
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 RIGHT JOIN t2 USING (a);
|
||||
SELECT any(toTypeName(a)) == 'Int32' AND any(toTypeName(t2.a)) == 'Int32' FROM t1 INNER JOIN t2 USING (a);
|
||||
|
||||
SELECT toTypeName(any(a)) == 'Int32' AND toTypeName(any(t2.a)) == 'Int32' FROM t1 FULL JOIN t2 USING (a);
|
||||
SELECT min(toTypeName(a) == 'Int32' AND toTypeName(t2.a) == 'Int32') FROM t1 FULL JOIN t2 USING (a);
|
||||
|
||||
SELECT * FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (a); -- { serverError 53 }
|
||||
SELECT * FROM t1 LEFT JOIN t2 ON(t1.a == t2.a) ORDER BY (a); -- { serverError 53 }
|
||||
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (a); -- { serverError 53 }
|
||||
SELECT * FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (a); -- { serverError 53 }
|
||||
|
||||
SET max_bytes_in_join = 0;
|
||||
|
||||
SELECT '--- join use nulls ---';
|
||||
|
||||
SET join_use_nulls = 1;
|
||||
|
||||
SELECT '- full -';
|
||||
SELECT a, b, t2.b FROM t1 FULL JOIN t2 USING (a) ORDER BY (a);
|
||||
SELECT '- right -';
|
||||
SELECT a, b, t2.b FROM t1 RIGHT JOIN t2 USING (a) ORDER BY (a);
|
||||
|
||||
SET join_use_nulls = 0;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
||||
select '---';
|
||||
|
||||
DROP TABLE IF EXISTS t_ab1;
|
||||
DROP TABLE IF EXISTS t_ab2;
|
||||
|
||||
@ -107,6 +168,8 @@ INSERT INTO t_ab2 VALUES (2, -1, 1), (3, 1, NULL), (4, 1, 257), (5, 1, -1), (6,
|
||||
|
||||
SELECT '--- hash ---';
|
||||
|
||||
SET join_algorithm = 'hash';
|
||||
|
||||
SELECT '- full -';
|
||||
SELECT a, b FROM t_ab1 FULL JOIN t_ab2 USING (a, b) ORDER BY ifNull(t_ab1.id, t_ab2.id);
|
||||
SELECT '- left -';
|
Loading…
Reference in New Issue
Block a user