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/11/24 19:49:45 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #38730: [SPARK-41181][SQL] Migrate the map options errors onto error classes

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


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -730,6 +730,23 @@
       "The <joinType> JOIN with LATERAL correlation is not allowed because an OUTER subquery cannot correlate to its join partner. Remove the LATERAL correlation or use an INNER JOIN, or LEFT OUTER JOIN instead."
     ]
   },
+  "INVALID_OPTIONS" : {
+    "message" : [
+      "Invalid options:"
+    ],
+    "subClass" : {
+      "NON_STRING_TYPE" : {
+        "message" : [
+          "A type of keys and values in map() must be string, but got <map>."

Review Comment:
   nit: `map` -> `mapType`



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -1013,13 +1013,13 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
 
   def keyValueInMapNotStringError(m: CreateMap): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1095",
-      messageParameters = Map("map" -> m.dataType.catalogString))
+      errorClass = "INVALID_OPTIONS.NON_STRING_TYPE",
+      messageParameters = Map("map" -> toSQLType(m.dataType)))
   }
 
   def nonMapFunctionNotAllowedError(): Throwable = {

Review Comment:
   Be sure the names are consistent. not or non



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -730,6 +730,23 @@
       "The <joinType> JOIN with LATERAL correlation is not allowed because an OUTER subquery cannot correlate to its join partner. Remove the LATERAL correlation or use an INNER JOIN, or LEFT OUTER JOIN instead."
     ]
   },
+  "INVALID_OPTIONS" : {
+    "message" : [
+      "Invalid options:"
+    ],
+    "subClass" : {
+      "NON_STRING_TYPE" : {
+        "message" : [
+          "A type of keys and values in map() must be string, but got <map>."
+        ]
+      },
+      "NOT_MAP_FUNCTION" : {
+        "message" : [
+          "Must use a map() function for options."

Review Comment:
   ```suggestion
             "Must use the `map()` function for options."
   ```



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -730,6 +730,23 @@
       "The <joinType> JOIN with LATERAL correlation is not allowed because an OUTER subquery cannot correlate to its join partner. Remove the LATERAL correlation or use an INNER JOIN, or LEFT OUTER JOIN instead."
     ]
   },
+  "INVALID_OPTIONS" : {
+    "message" : [
+      "Invalid options:"
+    ],
+    "subClass" : {
+      "NON_STRING_TYPE" : {
+        "message" : [
+          "A type of keys and values in map() must be string, but got <map>."
+        ]
+      },
+      "NOT_MAP_FUNCTION" : {

Review Comment:
   Why not `NON_MAP_FUNCTION`?



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