itholic commented on code in PR #39963:
URL: https://github.com/apache/spark/pull/39963#discussion_r1104623355


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -1537,6 +1537,12 @@
     ],
     "sqlState" : "42883"
   },
+  "UNRESOLVED_USING_COLUMN_FOR_JOIN" : {
+    "message" : [
+      "USING column <colName> cannot be resolved on the <side> side of the 
join. The <side>-side columns: [<plan>]."

Review Comment:
   Oh... we're using `StringUtils.orderStringsBySimilarity` that returns better 
candidates in `unresolvedColumnError` as below:
   ```scala
               val orderedCandidates =
                 StringUtils.orderStringsBySimilarity(f.name, candidates)
               throw QueryCompilationErrors.unresolvedColumnError(f.name, 
orderedCandidates)
   ```
   
   But, we're just pumping out all columns in 
`unresolvedColumnWithSuggestionError` as below:
   ```scala
     private def resolveException(colName: String, fields: Array[String]): 
AnalysisException = {
       QueryCompilationErrors.unresolvedColumnWithSuggestionError(
         colName, fields.map(toSQLId).mkString(", "))
     }
   ```
   
   Let me integrate `unresolvedColumnWithSuggestionError` into 
`unresolvedColumnError` so that we can display better suggestions in the error 
message.
   
   Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to