better fix

This commit is contained in:
chertus 2019-12-30 23:08:03 +03:00
parent 6b80ba52be
commit 928057c71f
3 changed files with 27 additions and 2 deletions

View File

@ -73,8 +73,9 @@ HashJoinPtr StorageJoin::getJoin(std::shared_ptr<AnalyzedJoin> analyzed_join) co
if (kind != analyzed_join->kind() || strictness != analyzed_join->strictness()) if (kind != analyzed_join->kind() || strictness != analyzed_join->strictness())
throw Exception("Table " + table_name + " has incompatible type of JOIN.", ErrorCodes::INCOMPATIBLE_TYPE_OF_JOIN); throw Exception("Table " + table_name + " has incompatible type of JOIN.", ErrorCodes::INCOMPATIBLE_TYPE_OF_JOIN);
if (analyzed_join->forceNullableRight() && !use_nulls) 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.", (!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); ErrorCodes::INCOMPATIBLE_TYPE_OF_JOIN);
/// TODO: check key columns /// TODO: check key columns

View File

@ -75,3 +75,16 @@ full (join_use_nulls)
4 a5 b4 4 a5 b4
4 a5 b5 4 a5 b5
5 \N b6 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

View File

@ -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 'full (join_use_nulls)';
SELECT * FROM t1 FULL JOIN full_join j USING(x) ORDER BY x, str, s; 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 t1;
DROP TABLE left_join; DROP TABLE left_join;