Merge pull request #65936 from hanfei1991/hanfei/exception-storage-join

add restriction for storage join
This commit is contained in:
Yarik Briukhovetskyi 2024-07-03 12:32:16 +00:00 committed by GitHub
commit d3ede543bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 46 additions and 1 deletions

View File

@ -395,11 +395,14 @@ void registerStorageJoin(StorageFactory & factory)
else if (kind_str == "full") else if (kind_str == "full")
{ {
if (strictness == JoinStrictness::Any) if (strictness == JoinStrictness::Any)
strictness = JoinStrictness::RightAny; throw Exception(ErrorCodes::NOT_IMPLEMENTED, "ANY FULL JOINs are not implemented");
kind = JoinKind::Full; kind = JoinKind::Full;
} }
} }
if ((strictness == JoinStrictness::Semi || strictness == JoinStrictness::Anti) && (kind != JoinKind::Left && kind != JoinKind::Right))
throw Exception(ErrorCodes::BAD_ARGUMENTS, " SEMI|ANTI JOIN should be LEFT or RIGHT");
if (kind == JoinKind::Comma) if (kind == JoinKind::Comma)
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Second parameter of storage Join must be LEFT or INNER or RIGHT or FULL (without quotes)."); throw Exception(ErrorCodes::BAD_ARGUMENTS, "Second parameter of storage Join must be LEFT or INNER or RIGHT or FULL (without quotes).");

View File

@ -0,0 +1,42 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(SEMI, ALL, a); -- { serverError BAD_ARGUMENTS }
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(SEMI, INNER, a); -- { serverError BAD_ARGUMENTS }
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(SEMI, FULL, a); -- { serverError BAD_ARGUMENTS }
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(ANTI, ALL, a); -- { serverError BAD_ARGUMENTS }
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(ANTI, INNER, a); -- { serverError BAD_ARGUMENTS }
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(ANTI, FULL, a); -- { serverError BAD_ARGUMENTS }
CREATE TABLE t1
(
a Int64,
b Int64
) Engine = Join(ANY, FULL, a); -- { serverError NOT_IMPLEMENTED }