Updated test for JOIN ON syntax. [#CLICKHOUSE-3761]

This commit is contained in:
Nikolai Kochetov 2018-08-14 21:00:04 +03:00
parent 6b3375393d
commit fce3bc193b
2 changed files with 43 additions and 0 deletions

View File

@ -51,3 +51,23 @@ duplicate column names
{"a1":1,"copy.a1":2}
{"a1":1,"copy.a1":2}
{"a1":1,"copy.a1":2}
subquery
1
1
1 2
1 2 2 3
1 2
subquery expression
2
1 2 2 3
1 2 2
subquery column alias
1 2 2 3
1 2 2 3
1 2 2 3
subquery alias
1 2 2 3
1 2 2 3
1 2 2 3
1 2 2 3
{"a1":1,"s.a1":2}

View File

@ -82,3 +82,26 @@ select a1, copy.a1 from test.tab1 any left join test.tab1_copy copy on tab1.b1 +
select a1, tab1_copy.a1 from test.tab1 any left join test.tab1_copy copy on tab1.b1 + 3 = b1 + 2 FORMAT JSONEachRow;
select a1, test.tab1_copy.a1 from test.tab1 any left join test.tab1_copy copy on tab1.b1 + 3 = b1 + 2 FORMAT JSONEachRow;
select 'subquery';
select a1 from test.tab1 any left join (select * from test.tab2) on b1 = a2;
select a1 from test.tab1 any left join (select a2 from test.tab2) on b1 = a2;
select a1, b1 from test.tab1 any left join (select * from test.tab2) on b1 = a2;
select a1, b1, a2, b2 from test.tab1 any left join (select * from test.tab2) on b1 = a2;
select a1, a2 from test.tab1 any left join (select a2 from test.tab2) on b1 = a2;
select 'subquery expression';
select b1 from test.tab1 any left join (select * from test.tab2) on toInt32(a1 + 1) = a2;
select a1, b1, a2, b2 from test.tab1 any left join (select * from test.tab2) on b1 + 1 = a2 + 1;
select a1, b1, a2 from test.tab1 any left join (select * from test.tab2) on b1 + 1 = a2 + 1;
select 'subquery column alias';
select a1, b1, a2, b2 from test.tab1 any left join (select *, a2 as z from test.tab2) on b1 + 1 = z + 1;
select a1, b1, a2, b2 from test.tab1 any left join (select *, a2 + 1 as z from test.tab2) on b1 + 1 = z;
select a1, b1, a2, b2 from test.tab1 any left join (select *, a2 + 1 as z from test.tab2) on b1 + 2 = z + 1 format TSV;
select 'subquery alias';
select a1, a2, b1, b2 from test.tab1 first any left join (select * from test.tab2) second on first.b1 = second.a2;
select a1, a2, b1, b2 from test.tab1 first any left join (select *, a2 as z from test.tab2) second on first.b1 = second.z;
select a1, a2, b1, b2 from test.tab1 first any left join (select *, a2 + 1 as z from test.tab2) second on first.b1 + 1 = second.z;
select tab1.a1, a2, test.tab1.b1, second.b2 from test.tab1 first any left join (select * from test.tab2) second on first.b1 = second.a2;
select a1, s.a1 from test.tab1 any left join (select * from test.tab1_copy) s on tab1.b1 + 3 = b1 + 2 FORMAT JSONEachRow;