This is an automated email from the ASF dual-hosted git repository.

maxgekk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new fe88d1d70fa0 [SPARK-50154][SQL] Assign appropriate error condition for 
`_LEGACY_ERROR_TEMP_0043`: `INVALID_RESET_COMMAND_FORMAT`
fe88d1d70fa0 is described below

commit fe88d1d70fa0fbca3061e99d482da5bf4557f3bf
Author: Haejoon Lee <[email protected]>
AuthorDate: Sat Nov 2 23:20:20 2024 +0100

    [SPARK-50154][SQL] Assign appropriate error condition for 
`_LEGACY_ERROR_TEMP_0043`: `INVALID_RESET_COMMAND_FORMAT`
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to assign proper error condition & sqlstate for 
`_LEGACY_ERROR_TEMP_0043`: `INVALID_RESET_COMMAND_FORMAT`
    
    ### Why are the changes needed?
    
    To improve the error message by assigning proper error condition and 
SQLSTATE
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, only user-facing error message improved
    
    ### How was this patch tested?
    
    Updated the existing tests
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No
    
    Closes #48689 from itholic/LEGACY_0043.
    
    Authored-by: Haejoon Lee <[email protected]>
    Signed-off-by: Max Gekk <[email protected]>
---
 .../src/main/resources/error/error-conditions.json     | 11 ++++++-----
 .../apache/spark/sql/errors/QueryParsingErrors.scala   |  2 +-
 .../spark/sql/execution/SparkSqlParserSuite.scala      | 18 +++++++++---------
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/common/utils/src/main/resources/error/error-conditions.json 
b/common/utils/src/main/resources/error/error-conditions.json
index 90348441e736..18603b61d8ae 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -2984,6 +2984,12 @@
     ],
     "sqlState" : "22023"
   },
+  "INVALID_RESET_COMMAND_FORMAT" : {
+    "message" : [
+      "Expected format is 'RESET' or 'RESET key'. If you want to include 
special characters in key, please use quotes, e.g., RESET `key`."
+    ],
+    "sqlState" : "42000"
+  },
   "INVALID_SAVE_MODE" : {
     "message" : [
       "The specified save mode <mode> is invalid. Valid save modes include 
\"append\", \"overwrite\", \"ignore\", \"error\", \"errorifexists\", and 
\"default\"."
@@ -5800,11 +5806,6 @@
       "It is not allowed to add catalog/namespace prefix <quoted> to the table 
name in CACHE TABLE AS SELECT."
     ]
   },
-  "_LEGACY_ERROR_TEMP_0043" : {
-    "message" : [
-      "Expected format is 'RESET' or 'RESET key'. If you want to include 
special characters in key, please use quotes, e.g., RESET `key`."
-    ]
-  },
   "_LEGACY_ERROR_TEMP_0045" : {
     "message" : [
       "Invalid time zone displacement value."
diff --git 
a/sql/api/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala 
b/sql/api/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala
index 953eacc7ff81..89ca45fa5125 100644
--- 
a/sql/api/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala
+++ 
b/sql/api/src/main/scala/org/apache/spark/sql/errors/QueryParsingErrors.scala
@@ -548,7 +548,7 @@ private[sql] object QueryParsingErrors extends 
DataTypeErrorsBase {
   }
 
   def unexpectedFormatForResetConfigurationError(ctx: 
ResetConfigurationContext): Throwable = {
-    new ParseException(errorClass = "_LEGACY_ERROR_TEMP_0043", ctx)
+    new ParseException(errorClass = "INVALID_RESET_COMMAND_FORMAT", ctx)
   }
 
   def intervalValueOutOfRangeError(input: String, ctx: IntervalContext): 
Throwable = {
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala
index 44da25678b5e..577994a1e0cb 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala
@@ -252,7 +252,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql1 = "RESET spark.sql.key1 key2"
     checkError(
       exception = parseException(sql1),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql1,
@@ -262,7 +262,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql2 = "RESET spark.  sql.key1 key2"
     checkError(
       exception = parseException(sql2),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql2,
@@ -272,7 +272,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql3 = "RESET spark.sql.key1 key2 key3"
     checkError(
       exception = parseException(sql3),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql3,
@@ -282,7 +282,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql4 = "RESET spark:   sql:key"
     checkError(
       exception = parseException(sql4),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql4,
@@ -292,7 +292,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql5 = "RESET spark   .sql.key"
     checkError(
       exception = parseException(sql5),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql5,
@@ -302,7 +302,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql6 = "RESET spark :  sql:key"
     checkError(
       exception = parseException(sql6),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql6,
@@ -312,7 +312,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql7 = "RESET spark.sql:   key"
     checkError(
       exception = parseException(sql7),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql7,
@@ -322,7 +322,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql8 = "RESET spark.sql   .key"
     checkError(
       exception = parseException(sql8),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql8,
@@ -332,7 +332,7 @@ class SparkSqlParserSuite extends AnalysisTest with 
SharedSparkSession {
     val sql9 = "RESET spark.sql :  key"
     checkError(
       exception = parseException(sql9),
-      condition = "_LEGACY_ERROR_TEMP_0043",
+      condition = "INVALID_RESET_COMMAND_FORMAT",
       parameters = Map.empty,
       context = ExpectedContext(
         fragment = sql9,


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

Reply via email to