From bd15b4e77f2ee4d918be9f7cbce4909b4a77d792 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Wed, 11 Nov 2020 14:15:25 +0300 Subject: [PATCH] Fix tests. --- src/Interpreters/ExpressionActions.cpp | 9 ++++----- src/Interpreters/ExpressionActions.h | 14 ++++---------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Interpreters/ExpressionActions.cpp b/src/Interpreters/ExpressionActions.cpp index 73e4bf9fde5..a51e8fe485c 100644 --- a/src/Interpreters/ExpressionActions.cpp +++ b/src/Interpreters/ExpressionActions.cpp @@ -69,9 +69,6 @@ ExpressionActions::ExpressionActions(ActionsDAGPtr actions_dag_) throw Exception(ErrorCodes::TOO_MANY_TEMPORARY_COLUMNS, "Too many temporary columns: {}. Maximum: {}", actions_dag->dumpNames(), std::to_string(settings.max_temporary_columns)); - - max_temporary_non_const_columns = settings.max_temporary_non_const_columns; - project_input = settings.project_input; } ExpressionActionsPtr ExpressionActions::clone() const @@ -259,6 +256,7 @@ std::string ExpressionActions::Action::toString() const void ExpressionActions::checkLimits(const ColumnsWithTypeAndName & columns) const { + auto max_temporary_non_const_columns = actions_dag->getSettings().max_temporary_non_const_columns; if (max_temporary_non_const_columns) { size_t non_const_columns = 0; @@ -440,7 +438,7 @@ void ExpressionActions::execute(Block & block, size_t & num_rows, bool dry_run) } } - if (project_input) + if (actions_dag->getSettings().project_input) { block.clear(); } @@ -528,7 +526,7 @@ std::string ExpressionActions::dumpActions() const for (const auto & output_column : output_columns) ss << output_column.name << " " << output_column.type->getName() << "\n"; - ss << "\nproject input: " << project_input << "\noutput positions:"; + ss << "\nproject input: " << actions_dag->getSettings().project_input << "\noutput positions:"; for (auto pos : result_positions) ss << " " << pos; ss << "\n"; @@ -706,6 +704,7 @@ ActionsDAGPtr ActionsDAG::splitActionsBeforeArrayJoin(const NameSet & array_join auto split_actions = cloneEmpty(); split_actions->nodes.swap(split_nodes); split_actions->index.swap(split_index); + split_actions->settings.project_input = false; return split_actions; } diff --git a/src/Interpreters/ExpressionActions.h b/src/Interpreters/ExpressionActions.h index 493e07b8bdf..e62f79614b4 100644 --- a/src/Interpreters/ExpressionActions.h +++ b/src/Interpreters/ExpressionActions.h @@ -273,8 +273,10 @@ private: }; -/** Contains a sequence of actions on the block. - */ +/// Sequence of actions on the block. +/// Is used to calculate expressions. +/// +/// Takes ActionsDAG and orders actions using top-sort. class ExpressionActions { public: @@ -313,11 +315,6 @@ private: ColumnNumbers result_positions; Block sample_block; - /// This flag means that all columns except input will be removed from block before execution. - bool project_input = false; - - size_t max_temporary_non_const_columns = 0; - friend class ActionsDAG; public: @@ -330,9 +327,6 @@ public: const std::list & getNodes() const { return actions_dag->getNodes(); } const ActionsDAG & getActionsDAG() const { return *actions_dag; } - /// Adds to the beginning the removal of all extra columns. - void projectInput() { project_input = true; } - /// Get a list of input columns. Names getRequiredColumns() const; const NamesAndTypesList & getRequiredColumnsWithTypes() const { return required_columns; }