You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/26 21:19:10 UTC

[GitHub] [spark] vitaliili-db commented on a diff in pull request #37621: [SPARK-40185][SQL] Remove column suggestion when the candidate list is empty

vitaliili-db commented on code in PR #37621:
URL: https://github.com/apache/spark/pull/37621#discussion_r956453516


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -164,35 +164,52 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
         s"side of the join. The $side-side columns: [${plan.output.map(_.name).mkString(", ")}]")
   }
 
+  private def unresolvedAttributeSuggestion(errorClass: String, candidates: Seq[String]): String = {
+    if (candidates.isEmpty) {
+      ""
+    } else {
+      val candidateIds = candidates.map(toSQLId).mkString(", ")
+      if (errorClass == "UNRESOLVED_MAP_KEY") {
+        s" Otherwise did you mean one of the following column(s)? [$candidateIds]"

Review Comment:
   That is such a great comment! Thank you, I added sub classes for respective errors. We also have some other instances of hard coded strings, I created a ticket ([SPARK-40236](https://issues.apache.org/jira/browse/SPARK-40236)) and fix those.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org