Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3444,13 +3444,13 @@ class Analyzer(override val catalogManager: CatalogManager)
private def resolveUserSpecifiedColumns(i: InsertIntoStatement): Seq[NamedExpression] = {
SchemaUtils.checkColumnNameDuplication(
i.userSpecifiedCols, "in the column list", resolver)

i.userSpecifiedCols.map { col =>
i.table.resolve(Seq(col), resolver).getOrElse {
val candidates = i.table.output.map(_.name)
val orderedCandidates = StringUtils.orderStringsBySimilarity(col, candidates)
val qualifiedCandidates = orderedCandidates.map(Seq(_))
throw QueryCompilationErrors
.unresolvedAttributeError("UNRESOLVED_COLUMN", col, orderedCandidates, i.origin)
.unresolvedAttributeError("UNRESOLVED_COLUMN", col, qualifiedCandidates, i.origin)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
errorClass: String): Nothing = {
val missingCol = a.sql
val candidates = operator.inputSet.toSeq.map(_.qualifiedName)
// Because the names are already qualified, do not attempt to parse them again.
val orderedCandidates = StringUtils.orderStringsBySimilarity(missingCol, candidates)
val qualifiedCandidates = orderedCandidates.map(Seq(_))
throw QueryCompilationErrors.unresolvedAttributeError(
errorClass, missingCol, orderedCandidates, a.origin)
errorClass, missingCol, qualifiedCandidates, a.origin)
}

def checkAnalysis(plan: LogicalPlan): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
def unresolvedAttributeError(
errorClass: String,
colName: String,
candidates: Seq[String],
candidates: Seq[Seq[String]],
origin: Origin): Throwable = {
val commonParam = Map("objectName" -> toSQLId(colName))
val proposalParam = if (candidates.isEmpty) {
Expand Down