mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
More fixes
This commit is contained in:
parent
06409a8aa3
commit
56e0dd0ab0
@ -74,12 +74,23 @@ bool ASTQueryWithOutput::resetOutputASTIfExist(IAST & ast)
|
||||
/// FIXME: try to prettify this cast using `as<>()`
|
||||
if (auto * ast_with_output = dynamic_cast<ASTQueryWithOutput *>(&ast))
|
||||
{
|
||||
ast_with_output->out_file.reset();
|
||||
ast_with_output->format.reset();
|
||||
ast_with_output->settings_ast.reset();
|
||||
ast_with_output->compression.reset();
|
||||
ast_with_output->compression_level.reset();
|
||||
ast_with_output->children.clear();
|
||||
auto remove_if_exists = [&](ASTPtr & p)
|
||||
{
|
||||
if (p)
|
||||
{
|
||||
if (auto it = std::find(ast_with_output->children.begin(), ast_with_output->children.end(), p);
|
||||
it != ast_with_output->children.end())
|
||||
ast_with_output->children.erase(it);
|
||||
p.reset();
|
||||
}
|
||||
};
|
||||
|
||||
remove_if_exists(ast_with_output->out_file);
|
||||
remove_if_exists(ast_with_output->format);
|
||||
remove_if_exists(ast_with_output->settings_ast);
|
||||
remove_if_exists(ast_with_output->compression);
|
||||
remove_if_exists(ast_with_output->compression_level);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,7 @@ bool ParserQueryWithOutput::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
ParserStringLiteral compression;
|
||||
if (!compression.parse(pos, query_with_output.compression, expected))
|
||||
return false;
|
||||
query_with_output.children.push_back(query_with_output.compression);
|
||||
|
||||
ParserKeyword s_compression_level("LEVEL");
|
||||
if (s_compression_level.ignore(pos, expected))
|
||||
@ -143,6 +144,7 @@ bool ParserQueryWithOutput::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
ParserNumber compression_level;
|
||||
if (!compression_level.parse(pos, query_with_output.compression_level, expected))
|
||||
return false;
|
||||
query_with_output.children.push_back(query_with_output.compression_level);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user