Split test join_implicit_cast (due to timeouts in flaky checks)

This commit is contained in:
vdimir 2021-02-19 14:17:15 +03:00
parent dc9e660522
commit 1a26310d27
No known key found for this signature in database
GPG Key ID: F57B3E10A21DBB31
4 changed files with 874 additions and 878 deletions

View File

@ -1,634 +1,5 @@
=== hash ===
= 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
= join on =
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= agg =
1
1
1
1
1
0 -10 0
1 55 1055
0 0 -10 0 990
1 55 15 1055 1015
= types =
1
1
1
1
1
1
1
1
1
1
1
=== partial_merge ===
= 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
= join on =
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= agg =
1
1
1
1
1
0 -10 0
1 55 1055
0 0 -10 0 990
1 55 15 1055 1015
= types =
1
1
1
1
1
1
1
1
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
= join on =
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= agg =
1
1
1
1
1
0 -10 0
1 55 1055
0 0 -10 0 990
1 55 15 1055 1015
= types =
1
1
1
1
1
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
2 2
-1 1

View File

@ -1,252 +1,3 @@
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (a UInt16, b UInt16) ENGINE = TinyLog;
CREATE TABLE t2 (a Int16, b Nullable(Int64)) ENGINE = TinyLog;
INSERT INTO t1 SELECT number as a, 100 + number as b FROM system.numbers LIMIT 1, 10;
INSERT INTO t2 SELECT number - 5 as a, 200 + number - 5 as b FROM system.numbers LIMIT 1, 10;
SELECT '=== hash ===';
SET join_algorithm = 'hash';
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 '= join on =';
SELECT '= full =';
SELECT a, b, t2.a, t2.b FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT a, b, t2.a, t2.b FROM t1 LEFT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT a, b, t2.a, t2.b FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT a, b, t2.a, t2.b FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= full =';
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
-- Int64 and UInt64 has no supertype
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
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 sum(a) == 2 + 3 + 4 FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) WHERE t1.b < 105 AND t2.b > 201;
SELECT a > 0, sum(a), sum(b) FROM t1 FULL JOIN t2 USING (a) GROUP BY (a > 0) ORDER BY a > 0;
SELECT a > 0, sum(a), sum(t2.a), sum(b), sum(t2.b) FROM t1 FULL JOIN t2 ON (t1.a == t2.a) GROUP BY (a > 0) ORDER BY a > 0;
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 any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 LEFT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 INNER JOIN t2 ON (t1.a == t2.a);
SELECT toTypeName(any(a)) == 'UInt16' AND toTypeName(any(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT '=== partial_merge ===';
SET join_algorithm = 'partial_merge';
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 '= join on =';
SELECT '= full =';
SELECT a, b, t2.a, t2.b FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT a, b, t2.a, t2.b FROM t1 LEFT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT a, b, t2.a, t2.b FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT a, b, t2.a, t2.b FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= full =';
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
-- Int64 and UInt64 has no supertype
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
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 sum(a) == 2 + 3 + 4 FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) WHERE t1.b < 105 AND t2.b > 201;
SELECT a > 0, sum(a), sum(b) FROM t1 FULL JOIN t2 USING (a) GROUP BY (a > 0) ORDER BY a > 0;
SELECT a > 0, sum(a), sum(t2.a), sum(b), sum(t2.b) FROM t1 FULL JOIN t2 ON (t1.a == t2.a) GROUP BY (a > 0) ORDER BY a > 0;
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 any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 LEFT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 INNER JOIN t2 ON (t1.a == t2.a);
SELECT toTypeName(any(a)) == 'UInt16' AND toTypeName(any(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
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 '= join on =';
SELECT '= full =';
SELECT a, b, t2.a, t2.b FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT a, b, t2.a, t2.b FROM t1 LEFT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT a, b, t2.a, t2.b FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT a, b, t2.a, t2.b FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= full =';
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
-- Int64 and UInt64 has no supertype
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
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 sum(a) == 2 + 3 + 4 FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) WHERE t1.b < 105 AND t2.b > 201;
SELECT a > 0, sum(a), sum(b) FROM t1 FULL JOIN t2 USING (a) GROUP BY (a > 0) ORDER BY a > 0;
SELECT a > 0, sum(a), sum(t2.a), sum(b), sum(t2.b) FROM t1 FULL JOIN t2 ON (t1.a == t2.a) GROUP BY (a > 0) ORDER BY a > 0;
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 any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 LEFT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 INNER JOIN t2 ON (t1.a == t2.a);
SELECT toTypeName(any(a)) == 'UInt16' AND toTypeName(any(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
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;

View File

@ -0,0 +1,628 @@
=== hash ===
= 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
= join on =
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= agg =
1
1
1
1
1
0 -10 0
1 55 1055
0 0 -10 0 990
1 55 15 1055 1015
= types =
1
1
1
1
1
1
1
1
1
1
1
=== partial_merge ===
= 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
= join on =
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= agg =
1
1
1
1
1
0 -10 0
1 55 1055
0 0 -10 0 990
1 55 15 1055 1015
= types =
1
1
1
1
1
1
1
1
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
= join on =
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= full =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= left =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
6 106 0 \N
7 107 0 \N
8 108 0 \N
9 109 0 \N
10 110 0 \N
= right =
0 0 -4 196
0 0 -3 197
0 0 -2 198
0 0 -1 199
0 0 0 200
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= inner =
1 101 1 201
2 102 2 202
3 103 3 203
4 104 4 204
5 105 5 205
= agg =
1
1
1
1
1
0 -10 0
1 55 1055
0 0 -10 0 990
1 55 15 1055 1015
= types =
1
1
1
1
1
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

View File

@ -0,0 +1,246 @@
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (a UInt16, b UInt16) ENGINE = TinyLog;
CREATE TABLE t2 (a Int16, b Nullable(Int64)) ENGINE = TinyLog;
INSERT INTO t1 SELECT number as a, 100 + number as b FROM system.numbers LIMIT 1, 10;
INSERT INTO t2 SELECT number - 5 as a, 200 + number - 5 as b FROM system.numbers LIMIT 1, 10;
SELECT '=== hash ===';
SET join_algorithm = 'hash';
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 '= join on =';
SELECT '= full =';
SELECT a, b, t2.a, t2.b FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT a, b, t2.a, t2.b FROM t1 LEFT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT a, b, t2.a, t2.b FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT a, b, t2.a, t2.b FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= full =';
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
-- Int64 and UInt64 has no supertype
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
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 sum(a) == 2 + 3 + 4 FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) WHERE t1.b < 105 AND t2.b > 201;
SELECT a > 0, sum(a), sum(b) FROM t1 FULL JOIN t2 USING (a) GROUP BY (a > 0) ORDER BY a > 0;
SELECT a > 0, sum(a), sum(t2.a), sum(b), sum(t2.b) FROM t1 FULL JOIN t2 ON (t1.a == t2.a) GROUP BY (a > 0) ORDER BY a > 0;
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 any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 LEFT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 INNER JOIN t2 ON (t1.a == t2.a);
SELECT toTypeName(any(a)) == 'UInt16' AND toTypeName(any(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT '=== partial_merge ===';
SET join_algorithm = 'partial_merge';
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 '= join on =';
SELECT '= full =';
SELECT a, b, t2.a, t2.b FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT a, b, t2.a, t2.b FROM t1 LEFT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT a, b, t2.a, t2.b FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT a, b, t2.a, t2.b FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= full =';
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
-- Int64 and UInt64 has no supertype
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
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 sum(a) == 2 + 3 + 4 FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) WHERE t1.b < 105 AND t2.b > 201;
SELECT a > 0, sum(a), sum(b) FROM t1 FULL JOIN t2 USING (a) GROUP BY (a > 0) ORDER BY a > 0;
SELECT a > 0, sum(a), sum(t2.a), sum(b), sum(t2.b) FROM t1 FULL JOIN t2 ON (t1.a == t2.a) GROUP BY (a > 0) ORDER BY a > 0;
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 any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 LEFT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 INNER JOIN t2 ON (t1.a == t2.a);
SELECT toTypeName(any(a)) == 'UInt16' AND toTypeName(any(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
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 '= join on =';
SELECT '= full =';
SELECT a, b, t2.a, t2.b FROM t1 FULL JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT a, b, t2.a, t2.b FROM t1 LEFT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT a, b, t2.a, t2.b FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT a, b, t2.a, t2.b FROM t1 INNER JOIN t2 ON (t1.a == t2.a) ORDER BY (t1.a, t2.a);
SELECT '= full =';
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= left =';
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= right =';
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
SELECT '= inner =';
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) ORDER BY (t1.a, t2.a);
-- Int64 and UInt64 has no supertype
SELECT * FROM t1 FULL JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
SELECT * FROM t1 INNER JOIN t2 ON (t1.a + t1.b + 100 = t2.a + t2.b) ORDER BY (t1.a, t2.a); -- { serverError 53 }
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 sum(a) == 2 + 3 + 4 FROM t1 FULL JOIN t2 ON (t1.a + t1.b = t2.a + t2.b - 100) WHERE t1.b < 105 AND t2.b > 201;
SELECT a > 0, sum(a), sum(b) FROM t1 FULL JOIN t2 USING (a) GROUP BY (a > 0) ORDER BY a > 0;
SELECT a > 0, sum(a), sum(t2.a), sum(b), sum(t2.b) FROM t1 FULL JOIN t2 ON (t1.a == t2.a) GROUP BY (a > 0) ORDER BY a > 0;
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 any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 LEFT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 RIGHT JOIN t2 ON (t1.a == t2.a);
SELECT any(toTypeName(a)) == 'UInt16' AND any(toTypeName(t2.a)) == 'Int16' FROM t1 INNER JOIN t2 ON (t1.a == t2.a);
SELECT toTypeName(any(a)) == 'UInt16' AND toTypeName(any(t2.a)) == 'Int16' FROM t1 FULL JOIN t2 ON (t1.a == t2.a);
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;