mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #60810 from Algunenano/compression_clone
Add missing clone calls related to compression
This commit is contained in:
commit
7989e9dc70
@ -59,11 +59,13 @@ public:
|
||||
if (database) { res->database = database->clone(); res->children.push_back(res->database); }
|
||||
if (table) { res->table = table->clone(); res->children.push_back(res->table); }
|
||||
if (columns) { res->columns = columns->clone(); res->children.push_back(res->columns); }
|
||||
if (select) { res->select = select->clone(); res->children.push_back(res->select); }
|
||||
if (watch) { res->watch = watch->clone(); res->children.push_back(res->watch); }
|
||||
if (table_function) { res->table_function = table_function->clone(); res->children.push_back(res->table_function); }
|
||||
if (partition_by) { res->partition_by = partition_by->clone(); res->children.push_back(res->partition_by); }
|
||||
if (settings_ast) { res->settings_ast = settings_ast->clone(); res->children.push_back(res->settings_ast); }
|
||||
if (select) { res->select = select->clone(); res->children.push_back(res->select); }
|
||||
if (watch) { res->watch = watch->clone(); res->children.push_back(res->watch); }
|
||||
if (infile) { res->infile = infile->clone(); res->children.push_back(res->infile); }
|
||||
if (compression) { res->compression = compression->clone(); res->children.push_back(res->compression); }
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -23,6 +23,16 @@ void ASTQueryWithOutput::cloneOutputOptions(ASTQueryWithOutput & cloned) const
|
||||
cloned.settings_ast = settings_ast->clone();
|
||||
cloned.children.push_back(cloned.settings_ast);
|
||||
}
|
||||
if (compression)
|
||||
{
|
||||
cloned.compression = compression->clone();
|
||||
cloned.children.push_back(cloned.compression);
|
||||
}
|
||||
if (compression_level)
|
||||
{
|
||||
cloned.compression_level = compression_level->clone();
|
||||
cloned.children.push_back(cloned.compression_level);
|
||||
}
|
||||
}
|
||||
|
||||
void ASTQueryWithOutput::formatImpl(const FormatSettings & s, FormatState & state, FormatStateStacked frame) const
|
||||
@ -64,9 +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->format.reset();
|
||||
ast_with_output->out_file.reset();
|
||||
ast_with_output->settings_ast.reset();
|
||||
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