mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
CLICKHOUSE-3934 add join_default_strictness
This commit is contained in:
parent
eb5f571935
commit
398d38eead
@ -389,6 +389,7 @@ namespace ErrorCodes
|
||||
extern const int NETLINK_ERROR = 412;
|
||||
extern const int CANNOT_SET_SIGNAL_HANDLER = 413;
|
||||
extern const int CANNOT_READLINE = 414;
|
||||
extern const int EXPECT_ALL_OR_ANY = 415;
|
||||
|
||||
extern const int KEEPER_EXCEPTION = 999;
|
||||
extern const int POCO_EXCEPTION = 1000;
|
||||
|
@ -96,6 +96,7 @@ namespace ErrorCodes
|
||||
extern const int CONDITIONAL_TREE_PARENT_NOT_FOUND;
|
||||
extern const int TYPE_MISMATCH;
|
||||
extern const int INVALID_JOIN_ON_EXPRESSION;
|
||||
extern const int EXPECT_ALL_OR_ANY;
|
||||
}
|
||||
|
||||
|
||||
@ -2483,7 +2484,18 @@ bool ExpressionAnalyzer::appendJoin(ExpressionActionsChain & chain, bool only_ty
|
||||
ExpressionActionsChain::Step & step = chain.steps.back();
|
||||
|
||||
const auto & join_element = static_cast<const ASTTablesInSelectQueryElement &>(*select_query->join());
|
||||
const auto & join_params = static_cast<const ASTTableJoin &>(*join_element.table_join);
|
||||
auto & join_params = static_cast<ASTTableJoin &>(*join_element.table_join);
|
||||
|
||||
if (join_params.strictness == ASTTableJoin::Strictness::Unspecified)
|
||||
{
|
||||
if (settings.join_default_strictness.toString() == "ANY")
|
||||
join_params.strictness = ASTTableJoin::Strictness::Any;
|
||||
else if (settings.join_default_strictness.toString() == "ALL")
|
||||
join_params.strictness = ASTTableJoin::Strictness::All;
|
||||
else
|
||||
throw Exception("Expected ANY or ALL, because setting (join_default_strictness) is empty.", DB::ErrorCodes::EXPECT_ALL_OR_ANY);
|
||||
}
|
||||
|
||||
const auto & table_to_join = static_cast<const ASTTableExpression &>(*join_element.table_expression);
|
||||
|
||||
getActionsFromJoinKeys(join_params, only_types, false, step.actions);
|
||||
|
@ -173,6 +173,8 @@ struct Settings
|
||||
\
|
||||
M(SettingBool, join_use_nulls, 0, "Use NULLs for non-joined rows of outer JOINs. If false, use default value of corresponding columns data type.") \
|
||||
\
|
||||
M(SettingString, join_default_strictness, "", "If settings not empty use ANY or ALL in JOIN SELECT query.") \
|
||||
\
|
||||
M(SettingUInt64, preferred_block_size_bytes, 1000000, "") \
|
||||
\
|
||||
M(SettingUInt64, max_replica_delay_for_distributed_queries, 300, "If set, distributed queries of Replicated tables will choose servers with replication delay in seconds less than the specified value (not inclusive). Zero means do not take delay into account.") \
|
||||
|
@ -136,6 +136,8 @@ bool ParserTablesInSelectQueryElement::parseImpl(Pos & pos, ASTPtr & node, Expec
|
||||
table_join->strictness = ASTTableJoin::Strictness::Any;
|
||||
else if (ParserKeyword("ALL").ignore(pos))
|
||||
table_join->strictness = ASTTableJoin::Strictness::All;
|
||||
else
|
||||
table_join->strictness = ASTTableJoin::Strictness::Unspecified;
|
||||
|
||||
if (ParserKeyword("INNER").ignore(pos))
|
||||
table_join->kind = ASTTableJoin::Kind::Inner;
|
||||
|
Loading…
Reference in New Issue
Block a user