Update comment for query AST cloning during inesrt into multiple local shards

Refs: https://github.com/ClickHouse/ClickHouse/pull/18264#discussion_r558839456
This commit is contained in:
Azat Khuzhin 2021-01-17 12:38:44 +03:00
parent d2366b5c6c
commit 858f07c796

View File

@ -352,7 +352,12 @@ DistributedBlockOutputStream::runWritingJob(DistributedBlockOutputStream::JobRep
/// Forward user settings
job.local_context = std::make_unique<Context>(context);
/// InterpreterInsertQuery is modifying the AST, but the same AST is also used to insert to remote shards.
/// Copying of the query AST is required to avoid race,
/// in case of INSERT into multiple local shards.
///
/// Since INSERT into local node uses AST,
/// and InterpreterInsertQuery::execute() is modifying it,
/// to resolve tables (in InterpreterInsertQuery::getTable())
auto copy_query_ast = query_ast->clone();
InterpreterInsertQuery interp(copy_query_ast, *job.local_context);