mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
better fix
This commit is contained in:
parent
6b80ba52be
commit
928057c71f
@ -73,8 +73,9 @@ HashJoinPtr StorageJoin::getJoin(std::shared_ptr<AnalyzedJoin> analyzed_join) co
|
||||
if (kind != analyzed_join->kind() || strictness != analyzed_join->strictness())
|
||||
throw Exception("Table " + table_name + " has incompatible type of JOIN.", ErrorCodes::INCOMPATIBLE_TYPE_OF_JOIN);
|
||||
|
||||
if (analyzed_join->forceNullableRight() && !use_nulls)
|
||||
throw Exception("Table " + table_name + " need join_use_nulls settings to support LEFT or FULL JOIN with join_use_nulls.",
|
||||
if ((analyzed_join->forceNullableRight() && !use_nulls) ||
|
||||
(!analyzed_join->forceNullableRight() && isLeftOrFull(analyzed_join->kind()) && use_nulls))
|
||||
throw Exception("Table " + table_name + " needs the same join_use_nulls setting as present in LEFT or FULL JOIN.",
|
||||
ErrorCodes::INCOMPATIBLE_TYPE_OF_JOIN);
|
||||
|
||||
/// TODO: check key columns
|
||||
|
@ -75,3 +75,16 @@ full (join_use_nulls)
|
||||
4 a5 b4
|
||||
4 a5 b5
|
||||
5 \N b6
|
||||
inner (join_use_nulls mix2)
|
||||
2 a3 b1
|
||||
2 a3 b2
|
||||
4 a5 b3
|
||||
4 a5 b4
|
||||
4 a5 b5
|
||||
right (join_use_nulls mix2)
|
||||
2 a3 b1
|
||||
2 a3 b2
|
||||
4 a5 b3
|
||||
4 a5 b4
|
||||
4 a5 b5
|
||||
5 b6
|
||||
|
@ -71,6 +71,17 @@ SELECT * FROM t1 RIGHT JOIN right_join j USING(x) ORDER BY x, str, s;
|
||||
SELECT 'full (join_use_nulls)';
|
||||
SELECT * FROM t1 FULL JOIN full_join j USING(x) ORDER BY x, str, s;
|
||||
|
||||
SET join_use_nulls = 0;
|
||||
|
||||
SELECT * FROM t1 LEFT JOIN left_join j USING(x) ORDER BY x, str, s; -- { serverError 264 }
|
||||
SELECT * FROM t1 FULL JOIN full_join j USING(x) ORDER BY x, str, s; -- { serverError 264 }
|
||||
|
||||
SELECT 'inner (join_use_nulls mix2)';
|
||||
SELECT * FROM t1 INNER JOIN inner_join j USING(x) ORDER BY x, str, s;
|
||||
|
||||
SELECT 'right (join_use_nulls mix2)';
|
||||
SELECT * FROM t1 RIGHT JOIN right_join j USING(x) ORDER BY x, str, s;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP TABLE left_join;
|
||||
|
Loading…
Reference in New Issue
Block a user