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/25 15:17:41 UTC

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

MaxGekk commented on code in PR #37621:
URL: https://github.com/apache/spark/pull/37621#discussion_r955101102


##########
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:
   Could you imagine that we will translate error messages in error-classes.json to local languages. It would be better if we put the text of error message to the json file, and parametrise it by some values that don't require translation.
   
   Is it possible to create sub-classes w/ suggestions in the json file?



-- 
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