You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2023/05/28 11:42:10 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #41346: [SPARK-43837][SQL] Assign a name to the error class _LEGACY_ERROR_TEMP_103[1-2]

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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -2877,14 +2877,18 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
 
   def invalidBoundaryStartError(start: Long): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1301",
-      messageParameters = Map("start" -> start.toString))
+      errorClass = "INVALID_BOUNDARY",
+      messageParameters = Map(
+        "boundary" -> "start",

Review Comment:
   Could you quote it as an id using `toSQLId`



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -904,6 +904,11 @@
     ],
     "sqlState" : "22003"
   },
+  "INVALID_BOUNDARY" : {
+    "message" : [
+      "Boundary <boundary> is not a valid integer: <value>."

Review Comment:
   Precisely, speaking:
   - `start` can be 0, Long.MinValue, or [Int.MinValue, Int.MaxValue]
   - `stop` - 0, Long.MaxValue, or [Int.MinValue, Int.MaxValue]
   
   Could you, please, add sub-classes like:
   ```
     "INVALID_BOUNDARY" : {
       "message" : [
         "The boundary <boundary> is invalid: <invalidValue>."
   ...
       "subClass" : {
         "START" : {
           "message" : [
             "Expected ... ."
           ]
         },
   ```
   



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -2877,14 +2877,18 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
 
   def invalidBoundaryStartError(start: Long): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1301",
-      messageParameters = Map("start" -> start.toString))
+      errorClass = "INVALID_BOUNDARY",
+      messageParameters = Map(
+        "boundary" -> "start",
+        "value" -> toSQLValue(start, LongType)))
   }
 
   def invalidBoundaryEndError(end: Long): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1302",
-      messageParameters = Map("end" -> end.toString))
+      errorClass = "INVALID_BOUNDARY",
+      messageParameters = Map(
+        "boundary" -> "end",

Review Comment:
   Wrap it by `toSQLId()`, please.



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