mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #48893 from ClickHouse/vdimir/analyzer_join_using_tests
This commit is contained in:
commit
75f9a7f087
@ -3,15 +3,27 @@
|
||||
1 l \N Nullable(String)
|
||||
2 \N Nullable(String)
|
||||
-
|
||||
1 l Nullable(String) \N Nullable(String)
|
||||
0 \N Nullable(String) \N Nullable(String)
|
||||
0 \N Nullable(String) \N Nullable(String)
|
||||
1 l Nullable(String) \N Nullable(String)
|
||||
-
|
||||
1 l LowCardinality(String) \N Nullable(String)
|
||||
0 LowCardinality(String) \N Nullable(String)
|
||||
0 LowCardinality(String) \N Nullable(String)
|
||||
1 l LowCardinality(String) \N Nullable(String)
|
||||
-
|
||||
1 l \N Nullable(String)
|
||||
0 \N \N Nullable(String)
|
||||
0 \N \N Nullable(String)
|
||||
1 l \N Nullable(String)
|
||||
-
|
||||
1 l \N Nullable(String)
|
||||
0 \N Nullable(String)
|
||||
0 \N Nullable(String)
|
||||
1 l \N Nullable(String)
|
||||
-
|
||||
1 l \N Nullable(String)
|
||||
0 \N Nullable(String)
|
||||
0 \N Nullable(String)
|
||||
1 l \N Nullable(String)
|
||||
0 \N
|
||||
-
|
||||
0
|
||||
-
|
||||
|
@ -15,19 +15,37 @@ SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (x) ORD
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x;
|
||||
-- lc should be supertype for l.lc and r.lc, so expect Nullable(String)
|
||||
SELECT x, lc, toTypeName(lc), r.lc, toTypeName(r.lc) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, toTypeName(lc), r.lc, toTypeName(r.lc) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, toTypeName(lc), r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x;
|
||||
-- old behavior is different
|
||||
SELECT x, lc, toTypeName(lc), r.lc, toTypeName(r.lc) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, toTypeName(lc), r.lc, toTypeName(r.lc) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, toTypeName(lc), r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc FROM t AS l RIGHT JOIN nr AS r USING (lc);
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc FROM t AS l RIGHT JOIN nr AS r USING (lc) SETTINGS allow_experimental_analyzer = 1;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc FROM t AS l RIGHT JOIN nr AS r USING (lc) SETTINGS allow_experimental_analyzer = 0;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
|
@ -4,6 +4,16 @@
|
||||
2 \N Nullable(String)
|
||||
-
|
||||
1 l \N Nullable(String)
|
||||
0 \N \N Nullable(String)
|
||||
0 \N \N Nullable(String)
|
||||
1 l \N Nullable(String)
|
||||
-
|
||||
1 l \N Nullable(String)
|
||||
0 \N \N Nullable(String)
|
||||
0 \N \N Nullable(String)
|
||||
1 l \N Nullable(String)
|
||||
-
|
||||
1 l \N Nullable(String)
|
||||
0 \N Nullable(String)
|
||||
0 \N Nullable(String)
|
||||
1 l \N Nullable(String)
|
||||
|
@ -17,15 +17,27 @@ SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (x) ORD
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 1;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, r.lc, toTypeName(r.lc) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l LEFT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l RIGHT JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
SELECT x, lc, materialize(r.lc) y, toTypeName(y) FROM t AS l FULL JOIN nr AS r USING (lc) ORDER BY x SETTINGS allow_experimental_analyzer = 0;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
|
@ -3,6 +3,16 @@
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N LowCardinality(String) Nullable(String)
|
||||
-
|
||||
\N \N Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
\N \N Nullable(String) LowCardinality(String)
|
||||
-
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N LowCardinality(String) Nullable(String)
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N LowCardinality(String) Nullable(String)
|
||||
-
|
||||
0 \N Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
0 \N Nullable(String) LowCardinality(String)
|
||||
|
@ -10,8 +10,27 @@ CREATE TABLE nr (`x` Nullable(UInt32), `s` Nullable(String)) ENGINE = Memory;
|
||||
INSERT INTO t VALUES (1, 'l');
|
||||
INSERT INTO nr VALUES (2, NULL);
|
||||
|
||||
|
||||
SET join_use_nulls = 0;
|
||||
|
||||
SET allow_experimental_analyzer = 1;
|
||||
|
||||
-- t.x is supertupe for `x` from left and right since `x` is inside `USING`.
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l LEFT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l RIGHT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l FULL JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l LEFT JOIN t AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l RIGHT JOIN t AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l FULL JOIN t AS r USING (x) ORDER BY t.x;
|
||||
|
||||
SELECT '-';
|
||||
|
||||
SET allow_experimental_analyzer = 0;
|
||||
|
||||
-- t.x is supertupe for `x` from left and right since `x` is inside `USING`.
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l LEFT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l RIGHT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l FULL JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
|
@ -17,7 +17,7 @@
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
0 \N Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
-
|
||||
- join_use_nulls -
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
1 l \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
@ -33,3 +33,47 @@
|
||||
1 l \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
\N \N \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
-
|
||||
\N \N \N Nullable(String) LowCardinality(Nullable(String))
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(Nullable(String))
|
||||
\N \N \N Nullable(String) LowCardinality(Nullable(String))
|
||||
- analyzer -
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N LowCardinality(String) Nullable(String)
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N LowCardinality(String) Nullable(String)
|
||||
-
|
||||
\N \N Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
\N \N Nullable(String) LowCardinality(String)
|
||||
-
|
||||
1 l \N Nullable(String) Nullable(String)
|
||||
0 \N \N Nullable(String) Nullable(String)
|
||||
0 \N \N Nullable(String) Nullable(String)
|
||||
1 l \N Nullable(String) Nullable(String)
|
||||
-
|
||||
0 \N \N Nullable(String) Nullable(String)
|
||||
1 \N l Nullable(String) Nullable(String)
|
||||
0 \N \N Nullable(String) Nullable(String)
|
||||
1 \N l Nullable(String) Nullable(String)
|
||||
- join_use_nulls -
|
||||
1 l \N LowCardinality(String) Nullable(String)
|
||||
2 \N \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
1 l \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
2 \N \N LowCardinality(Nullable(String)) Nullable(String)
|
||||
-
|
||||
\N \N \N Nullable(String) LowCardinality(Nullable(String))
|
||||
1 \N l Nullable(String) LowCardinality(String)
|
||||
1 \N l Nullable(String) LowCardinality(Nullable(String))
|
||||
\N \N \N Nullable(String) LowCardinality(Nullable(String))
|
||||
-
|
||||
1 l \N Nullable(String) Nullable(String)
|
||||
\N \N \N Nullable(String) Nullable(String)
|
||||
1 l \N Nullable(String) Nullable(String)
|
||||
\N \N \N Nullable(String) Nullable(String)
|
||||
-
|
||||
\N \N \N Nullable(String) Nullable(String)
|
||||
1 \N l Nullable(String) Nullable(String)
|
||||
1 \N l Nullable(String) Nullable(String)
|
||||
\N \N \N Nullable(String) Nullable(String)
|
||||
|
@ -10,6 +10,14 @@ CREATE TABLE nr (`x` Nullable(UInt32), `s` Nullable(String)) ENGINE = Memory;
|
||||
INSERT INTO t VALUES (1, 'l');
|
||||
INSERT INTO nr VALUES (2, NULL);
|
||||
|
||||
{% for allow_experimental_analyzer in [0, 1] -%}
|
||||
|
||||
SET allow_experimental_analyzer = {{ allow_experimental_analyzer }};
|
||||
|
||||
{% if allow_experimental_analyzer -%}
|
||||
SELECT '- analyzer -';
|
||||
{% endif -%}
|
||||
|
||||
SET join_use_nulls = 0;
|
||||
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l LEFT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
@ -36,7 +44,7 @@ SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l FULL JOIN t
|
||||
|
||||
SET join_use_nulls = 1;
|
||||
|
||||
SELECT '-';
|
||||
SELECT '- join_use_nulls -';
|
||||
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l LEFT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l RIGHT JOIN nr AS r USING (x) ORDER BY t.x;
|
||||
@ -56,10 +64,11 @@ SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM t AS l FULL JOIN nr
|
||||
|
||||
SELECT '-';
|
||||
|
||||
-- TODO
|
||||
-- SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l LEFT JOIN t AS r USING (s) ORDER BY t.x;
|
||||
-- SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l RIGHT JOIN t AS r USING (s) ORDER BY t.x;
|
||||
-- SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l FULL JOIN t AS r USING (s) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l LEFT JOIN t AS r USING (s) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l RIGHT JOIN t AS r USING (s) ORDER BY t.x;
|
||||
SELECT t.x, l.s, r.s, toTypeName(l.s), toTypeName(r.s) FROM nr AS l FULL JOIN t AS r USING (s) ORDER BY t.x;
|
||||
|
||||
{% endfor %}
|
||||
|
||||
DROP TABLE t;
|
||||
DROP TABLE nr;
|
Loading…
Reference in New Issue
Block a user