mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 09:52:38 +00:00
576b407804
* Try to enforce table identification in CollectJoinOnKeysMatcher * Support filtering conditions in JOIN ON for HashJoin * Correct handle non equi join * Update test 00878_join_unexpected_results * Join on filters calculated as one row before join * Do not lookup key in hash join if condition for row is not hold * better * Support filtering conditions in JOIN ON for MergeJoin * Support Nullable mask in JOIN ON section * Fix style in Interpreters/TableJoin.cpp * Change return type of getColumnAsMask in join_common to ColumnPtr * Handle Nullable(Nothing) type in JOIN ON section, add test cases * Fix type cast JoinCommon::getColumnAsMask * Check type if conditions in JOIN ON section, support functions * Update tests with JOIN ON * Style changes, add comments for conditions in JOIN ON section * Add test cases for join on condtions * JOIN ON key1 = key2 AND (cond1 OR cond2) * Remove CollectJoinOnKeysVisitor has_join_keys * Add test cases for join on nullable/lc conditions * Fix style * Change error code 48 to 403 in join on tests * Fix whitespace
72 lines
2.6 KiB
SQL
72 lines
2.6 KiB
SQL
drop table if exists t;
|
|
drop table if exists s;
|
|
|
|
create table t(a Int64, b Int64) engine = Memory;
|
|
create table s(a Int64, b Int64) engine = Memory;
|
|
|
|
insert into t values (1,1), (2,2);
|
|
insert into s values (1,1);
|
|
|
|
select 'join_use_nulls = 1';
|
|
set join_use_nulls = 1;
|
|
select * from t left outer join s using (a,b) order by t.a;
|
|
select '-';
|
|
select * from t join s using (a,b);
|
|
select '-';
|
|
select * from t join s on (t.a=s.a and t.b=s.b);
|
|
select '-';
|
|
select t.* from t left join s on (t.a=s.a and t.b=s.b) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (t.a=s.a and t.b=s.b) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (s.a=t.a and t.b=s.b) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t right join s on (t.a=s.a and t.b=s.b);
|
|
select '-';
|
|
select * from t left outer join s using (a,b) where s.a is null;
|
|
select '-';
|
|
select * from t left outer join s on (t.a=s.a and t.b=s.b) where s.a is null;
|
|
select '-';
|
|
select s.* from t left outer join s on (t.a=s.a and t.b=s.b) where s.a is null;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (s.a=t.a and t.b=s.b and t.a=toInt64(2)) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (s.a=t.a) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (t.b=toInt64(1) and s.a=t.a) where s.b=1;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (t.b=toInt64(2) and s.a=t.a) where t.b=2;
|
|
|
|
select 'join_use_nulls = 0';
|
|
set join_use_nulls = 0;
|
|
select * from t left outer join s using (a,b) order by t.a;
|
|
select '-';
|
|
select * from t join s using (a,b);
|
|
select '-';
|
|
select * from t join s on (t.a=s.a and t.b=s.b);
|
|
select '-';
|
|
select t.* from t left join s on (t.a=s.a and t.b=s.b) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (t.a=s.a and t.b=s.b) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (s.a=t.a and t.b=s.b) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t right join s on (t.a=s.a and t.b=s.b);
|
|
select '-';
|
|
-- select * from t left outer join s using (a,b) where s.a is null; -- TODO
|
|
select '-';
|
|
-- select * from t left outer join s on (t.a=s.a and t.b=s.b) where s.a is null; -- TODO
|
|
select '-';
|
|
-- select s.* from t left outer join s on (t.a=s.a and t.b=s.b) where s.a is null; -- TODO
|
|
select '-';
|
|
select t.*, s.* from t left join s on (s.a=t.a and t.b=s.b and t.a=toInt64(2)) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (s.a=t.a) order by t.a;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (t.b=toInt64(1) and s.a=t.a) where s.b=1;
|
|
select '-';
|
|
select t.*, s.* from t left join s on (t.b=toInt64(2) and s.a=t.a) where t.b=2;
|
|
|
|
drop table t;
|
|
drop table s;
|