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/08 15:08:12 UTC

[GitHub] [spark] srielau commented on a diff in pull request #38537: [SPARK-41043][SQL] Rename the error class `_LEGACY_ERROR_TEMP_2429` to `COLUMNS_NUM_MISMATCH`

srielau commented on code in PR #38537:
URL: https://github.com/apache/spark/pull/38537#discussion_r1016742349


##########
core/src/main/resources/error/error-classes.json:
##########
@@ -94,6 +94,11 @@
     ],
     "sqlState" : "22005"
   },
+  "COLUMNS_NUM_MISMATCH" : {

Review Comment:
   This sounds unnecessarily awkward... How about;
   ```suggestion
     "NUM_COLUMNNS_MISMATCH" : {
   ```



##########
sql/core/src/test/resources/sql-tests/results/except-all.sql.out:
##########
@@ -228,12 +228,12 @@ struct<>
 -- !query output
 org.apache.spark.sql.AnalysisException
 {
-  "errorClass" : "_LEGACY_ERROR_TEMP_2429",
+  "errorClass" : "COLUMNS_NUM_MISMATCH",
   "messageParameters" : {
-    "firstColNum" : "1",
-    "nColNum" : "2",
-    "nTab" : "second",
-    "operator" : "ExceptAll"
+    "invalidColumnsNum" : "2",
+    "invalidOrdinalNum" : "second",
+    "operator" : "EXCEPTALL",
+    "refColumnsNum" : "1"

Review Comment:
   ```suggestion
       "invalidNumColumns" : "2",
       "invalidOrdinalNum" : "second",
       "operator" : "EXCEPTALL",
       "refNumColumns" : "1"
   ```



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -541,12 +541,12 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
               // Check the number of columns
               if (child.output.length != ref.length) {
                 e.failAnalysis(
-                  errorClass = "_LEGACY_ERROR_TEMP_2429",
+                  errorClass = "COLUMNS_NUM_MISMATCH",

Review Comment:
   ```suggestion
                     errorClass = "NUM_COLUMNS_MISMATCH",
   ```



##########
core/src/main/resources/error/error-classes.json:
##########
@@ -94,6 +94,11 @@
     ],
     "sqlState" : "22005"
   },
+  "COLUMNS_NUM_MISMATCH" : {
+    "message" : [
+      "<operator> can only be performed on tables with the same number of columns, but the first table has <refColumnsNum> columns and the <invalidOrdinalNum> table has <invalidColumnsNum> columns."

Review Comment:
   ```suggestion
         "<operator> can only be performed on tables with the same number of columns, but the first table has <refNumColumns> columns and the <invalidOrdinalNum> table has <invalidNumColumns> columns."
   ```



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -541,12 +541,12 @@ trait CheckAnalysis extends PredicateHelper with LookupCatalog {
               // Check the number of columns
               if (child.output.length != ref.length) {
                 e.failAnalysis(
-                  errorClass = "_LEGACY_ERROR_TEMP_2429",
+                  errorClass = "COLUMNS_NUM_MISMATCH",
                   messageParameters = Map(
-                    "operator" -> operator.nodeName,
-                    "firstColNum" -> ref.length.toString,
-                    "nTab" -> ordinalNumber(ti + 1),
-                    "nColNum" -> child.output.length.toString))
+                    "operator" -> toSQLStmt(operator.nodeName),
+                    "refColumnsNum" -> ref.length.toString,
+                    "invalidOrdinalNum" -> ordinalNumber(ti + 1),
+                    "invalidColumnsNum" -> child.output.length.toString))

Review Comment:
   ```suggestion
                       "refNumColumns" -> ref.length.toString,
                       "invalidOrdinalNum" -> ordinalNumber(ti + 1),
                       "invalidNumColumns" -> child.output.length.toString))
   ```



##########
sql/core/src/test/resources/sql-tests/results/except-all.sql.out:
##########
@@ -228,12 +228,12 @@ struct<>
 -- !query output
 org.apache.spark.sql.AnalysisException
 {
-  "errorClass" : "_LEGACY_ERROR_TEMP_2429",
+  "errorClass" : "COLUMNS_NUM_MISMATCH",

Review Comment:
   ```suggestion
     "errorClass" : "NUM_COLUMNS_MISMATCH",
   ```



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