mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Better
This commit is contained in:
parent
9cb018545c
commit
f0b514acae
@ -83,4 +83,24 @@ DiskConfigurationPtr getDiskConfigurationFromAST(const std::string & root_name,
|
||||
return conf;
|
||||
}
|
||||
|
||||
|
||||
ASTs convertDiskConfigurationToAST(const Poco::Util::AbstractConfiguration & configuration, const std::string & config_path)
|
||||
{
|
||||
ASTs result;
|
||||
|
||||
Poco::Util::AbstractConfiguration::Keys keys;
|
||||
configuration.keys(config_path, keys);
|
||||
|
||||
for (const auto & key : keys)
|
||||
{
|
||||
result.push_back(
|
||||
makeASTFunction(
|
||||
"equals",
|
||||
std::make_shared<ASTIdentifier>(key),
|
||||
std::make_shared<ASTLiteral>(configuration.getString(config_path + "." + key))));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,4 +25,12 @@ using DiskConfigurationPtr = Poco::AutoPtr<Poco::Util::AbstractConfiguration>;
|
||||
*/
|
||||
DiskConfigurationPtr getDiskConfigurationFromAST(const std::string & root_name, const ASTs & disk_args, ContextPtr context);
|
||||
|
||||
/// The same as above function, but return XML::Document for easier modification of result configuration.
|
||||
[[ maybe_unused ]] Poco::AutoPtr<Poco::XML::Document> getDiskConfigurationFromASTImpl(const std::string & root_name, const ASTs & disk_args, ContextPtr context);
|
||||
|
||||
/*
|
||||
* A reverse function.
|
||||
*/
|
||||
[[ maybe_unused ]] ASTs convertDiskConfigurationToAST(const Poco::Util::AbstractConfiguration & configuration, const std::string & config_path);
|
||||
|
||||
}
|
||||
|
@ -45,6 +45,12 @@ void ASTDeleteQuery::formatQueryImpl(const FormatSettings & settings, FormatStat
|
||||
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << " WHERE " << (settings.hilite ? hilite_none : "");
|
||||
predicate->formatImpl(settings, state, frame);
|
||||
|
||||
if (settings_ast)
|
||||
{
|
||||
settings.ostr << (settings.hilite ? hilite_keyword : "") << settings.nl_or_ws << "SETTINGS " << (settings.hilite ? hilite_none : "");
|
||||
settings_ast->formatImpl(settings, state, frame);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2151,8 +2151,9 @@ bool ParserTTLElement::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
ParserKeyword s_set("SET");
|
||||
ParserKeyword s_recompress("RECOMPRESS");
|
||||
ParserKeyword s_codec("CODEC");
|
||||
ParserToken s_comma(TokenType::Comma);
|
||||
ParserToken s_eq(TokenType::Equals);
|
||||
ParserKeyword s_materialize("MATERIALIZE");
|
||||
ParserKeyword s_remove("REMOVE");
|
||||
ParserKeyword s_modify("MODIFY");
|
||||
|
||||
ParserIdentifier parser_identifier;
|
||||
ParserStringLiteral parser_string_literal;
|
||||
@ -2160,8 +2161,11 @@ bool ParserTTLElement::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
ParserExpressionList parser_keys_list(false);
|
||||
ParserCodec parser_codec;
|
||||
|
||||
ParserList parser_assignment_list(
|
||||
std::make_unique<ParserAssignment>(), std::make_unique<ParserToken>(TokenType::Comma));
|
||||
if (s_materialize.checkWithoutMoving(pos, expected) ||
|
||||
s_remove.checkWithoutMoving(pos, expected) ||
|
||||
s_modify.checkWithoutMoving(pos, expected))
|
||||
|
||||
return false;
|
||||
|
||||
ASTPtr ttl_expr;
|
||||
if (!parser_exp.parse(pos, ttl_expr, expected))
|
||||
@ -2219,6 +2223,9 @@ bool ParserTTLElement::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
|
||||
if (s_set.ignore(pos))
|
||||
{
|
||||
ParserList parser_assignment_list(
|
||||
std::make_unique<ParserAssignment>(), std::make_unique<ParserToken>(TokenType::Comma));
|
||||
|
||||
if (!parser_assignment_list.parse(pos, group_by_assignments, expected))
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user