Analyzer identifier resolution for subcolumns fix

This commit is contained in:
Maksim Kita 2023-01-25 11:36:21 +01:00
parent 25da9dcef7
commit 484fc40e64
2 changed files with 8 additions and 6 deletions

View File

@ -99,7 +99,9 @@ QueryTreeNodePtr ColumnNode::cloneImpl() const
ASTPtr ColumnNode::toASTImpl() const
{
return std::make_shared<ASTIdentifier>(column.name);
auto column_name_identifier = Identifier(column.name);
auto column_name_identifier_parts = column_name_identifier.getParts();
return std::make_shared<ASTIdentifier>(std::move(column_name_identifier_parts));
}
}

View File

@ -408,14 +408,14 @@ struct TableExpressionData
ColumnNameToColumnNodeMap column_name_to_column_node;
std::unordered_set<std::string, StringTransparentHash, std::equal_to<>> 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,