From f81a5d0d85892f060e2b3aeca92b1a5c9dab0d6d Mon Sep 17 00:00:00 2001 From: Vyacheslav Alipov Date: Thu, 1 Aug 2013 15:06:41 +0000 Subject: [PATCH] fixes, going to reorganize ExpressionActions::Action::array_joined_columns [#CONV-7967] --- dbms/src/Interpreters/ExpressionActions.cpp | 8 ++++---- dbms/src/Interpreters/ExpressionAnalyzer.cpp | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dbms/src/Interpreters/ExpressionActions.cpp b/dbms/src/Interpreters/ExpressionActions.cpp index 5ded9edf54c..8513aea180f 100644 --- a/dbms/src/Interpreters/ExpressionActions.cpp +++ b/dbms/src/Interpreters/ExpressionActions.cpp @@ -30,17 +30,17 @@ bool ExpressionActions::Action::isArrayJoinedColumnName(const String & name) con { std::string nested_table = DataTypeNested::extractNestedTableName(name); std::string nested_column = DataTypeNested::extractNestedColumnName(name); - return nested_column == nested_table_alias || (nested_table == nested_table_alias && array_joined_columns.count(nested_column)); + return name == nested_table_alias || (nested_table == nested_table_alias && array_joined_columns.count(nested_column)); } String ExpressionActions::Action::getOriginalNestedName(const String & name) const { + if (name == nested_table_alias) + return nested_table_name; + std::string nested_table = DataTypeNested::extractNestedTableName(name); std::string nested_column = DataTypeNested::extractNestedColumnName(name); - if (nested_column == nested_table_alias) - return nested_table_name; - if (nested_table == nested_table_alias && array_joined_columns.count(nested_column)) return DataTypeNested::concatenateNestedName(nested_table_name, nested_column); diff --git a/dbms/src/Interpreters/ExpressionAnalyzer.cpp b/dbms/src/Interpreters/ExpressionAnalyzer.cpp index a6c20d1c583..2243a15d242 100644 --- a/dbms/src/Interpreters/ExpressionAnalyzer.cpp +++ b/dbms/src/Interpreters/ExpressionAnalyzer.cpp @@ -603,11 +603,11 @@ void ExpressionAnalyzer::addMultipleArrayJoinAction(ExpressionActions & actions) { String nested_table = DataTypeNested::extractNestedTableName(*it); String nested_column = DataTypeNested::extractNestedColumnName(*it); - - if (nested_column == nested_table_name || (nested_table == nested_table_name && array_joined_columns.count(nested_column))) + + if (*it == nested_table_name || nested_table == nested_table_name) { added_columns = true; - String array_joined_name = nested_column == nested_table_name + String array_joined_name = *it == nested_table_name ? nested_table_alias : DataTypeNested::concatenateNestedName(nested_table_alias, nested_column); actions.add(ExpressionActions::Action::copyColumn(*it, array_joined_name));