From c2455e1182dcff9c4d8f849d6f5f608e0b09dda7 Mon Sep 17 00:00:00 2001 From: Michael Kolupaev Date: Fri, 21 Jun 2013 10:36:01 +0000 Subject: [PATCH] clickhouse: fixed ExpressionAnalyzer [#CONV-7444]. --- dbms/src/Interpreters/ExpressionAnalyzer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dbms/src/Interpreters/ExpressionAnalyzer.cpp b/dbms/src/Interpreters/ExpressionAnalyzer.cpp index a9d51a5f317..89a451a13a4 100644 --- a/dbms/src/Interpreters/ExpressionAnalyzer.cpp +++ b/dbms/src/Interpreters/ExpressionAnalyzer.cpp @@ -1027,18 +1027,21 @@ void ExpressionAnalyzer::removeUnusedColumns() if (required.empty()) required.insert(ExpressionActions::getSmallestColumn(columns)); + unknown_required_columns = required; + for (NamesAndTypesList::iterator it = columns.begin(); it != columns.end();) { NamesAndTypesList::iterator it0 = it; ++it; + + unknown_required_columns.erase(it0->first); + if (!required.count(it0->first)) { required.erase(it0->first); columns.erase(it0); } } - - unknown_required_columns = required; } Names ExpressionAnalyzer::getRequiredColumns()