diff --git a/src/Analyzer/ColumnNode.cpp b/src/Analyzer/ColumnNode.cpp index 52c264ba1c7..1b367829510 100644 --- a/src/Analyzer/ColumnNode.cpp +++ b/src/Analyzer/ColumnNode.cpp @@ -99,7 +99,9 @@ QueryTreeNodePtr ColumnNode::cloneImpl() const ASTPtr ColumnNode::toASTImpl() const { - return std::make_shared(column.name); + auto column_name_identifier = Identifier(column.name); + auto column_name_identifier_parts = column_name_identifier.getParts(); + return std::make_shared(std::move(column_name_identifier_parts)); } } diff --git a/src/Analyzer/Passes/QueryAnalysisPass.cpp b/src/Analyzer/Passes/QueryAnalysisPass.cpp index 0c9b1f6ffac..7fde467921a 100644 --- a/src/Analyzer/Passes/QueryAnalysisPass.cpp +++ b/src/Analyzer/Passes/QueryAnalysisPass.cpp @@ -408,14 +408,14 @@ struct TableExpressionData ColumnNameToColumnNodeMap column_name_to_column_node; std::unordered_set> column_identifier_first_parts; - bool hasFullIdentifierName(IdentifierView identifier) const + bool hasFullIdentifierName(IdentifierView identifier_view) const { - return column_name_to_column_node.contains(std::string_view(identifier.getFullName())); + return column_name_to_column_node.contains(identifier_view.getFullName()); } - bool canBindIdentifier(IdentifierView identifier) const + bool canBindIdentifier(IdentifierView identifier_view) const { - return column_identifier_first_parts.contains(std::string_view(identifier.at(0))); + return column_identifier_first_parts.contains(identifier_view.at(0)); } [[maybe_unused]] void dump(WriteBuffer & buffer) const @@ -2130,7 +2130,7 @@ QueryTreeNodePtr QueryAnalyzer::tryResolveIdentifierFromCompoundExpression(const compound_expression_from_error_message += compound_expression_source; } - throw Exception(ErrorCodes::BAD_ARGUMENTS, + throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER, "Identifier {} nested path {} cannot be resolved from type {}{}. In scope {}{}", expression_identifier, nested_path,