diff --git a/dbms/src/Interpreters/MutationsInterpreter.cpp b/dbms/src/Interpreters/MutationsInterpreter.cpp index 32016f73f84..16517532e38 100644 --- a/dbms/src/Interpreters/MutationsInterpreter.cpp +++ b/dbms/src/Interpreters/MutationsInterpreter.cpp @@ -209,11 +209,11 @@ void MutationsInterpreter::prepare(bool dry_run) validateUpdateColumns(storage, updated_columns, column_to_affected_materialized); /// First, break a sequence of commands into stages. - stages.emplace_back(); + stages.emplace_back(context); for (const auto & command : commands) { if (!stages.back().column_to_updated.empty()) - stages.emplace_back(); + stages.emplace_back(context); if (command.type == MutationCommand::DELETE) { @@ -223,7 +223,7 @@ void MutationsInterpreter::prepare(bool dry_run) else if (command.type == MutationCommand::UPDATE) { if (stages.size() == 1) /// First stage only supports filtering and can't update columns. - stages.emplace_back(); + stages.emplace_back(context); NameSet affected_materialized; @@ -250,7 +250,7 @@ void MutationsInterpreter::prepare(bool dry_run) if (!affected_materialized.empty()) { - stages.emplace_back(); + stages.emplace_back(context); for (const auto & column : columns_desc.materialized) { stages.back().column_to_updated.emplace( diff --git a/dbms/src/Interpreters/MutationsInterpreter.h b/dbms/src/Interpreters/MutationsInterpreter.h index f71c1ddcd14..8c91c9cef60 100644 --- a/dbms/src/Interpreters/MutationsInterpreter.h +++ b/dbms/src/Interpreters/MutationsInterpreter.h @@ -59,6 +59,8 @@ private: struct Stage { + Stage(const Context & context) : expressions_chain(context) {} + ASTs filters; std::unordered_map column_to_updated;