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 6c74e355715 [SPARK-43387][SQL] Provide a human readable error code for _LEGACY_ERROR_TEMP_1168 6c74e355715 is described below commit 6c74e355715882e69c6140af3c52010c8e8258d4 Author: Eric Ogren <eog...@gmail.com> AuthorDate: Sat May 6 12:07:34 2023 +0300 [SPARK-43387][SQL] Provide a human readable error code for _LEGACY_ERROR_TEMP_1168 ### What changes were proposed in this pull request? Change the error code of `_LEGACY_ERROR_TEMP_1168` -> `INSERT_COLUMN_ARITY_MISMATCH` ### Why are the changes needed? Cleaning up legacy error codes ### Does this PR introduce _any_ user-facing change? Yes - changes error code for legacy error. ### How was this patch tested? existing tests suffice Closes #41068 from eogren/SPARK-43387. Authored-by: Eric Ogren <eog...@gmail.com> Signed-off-by: Max Gekk <max.g...@gmail.com> --- core/src/main/resources/error/error-classes.json | 11 ++++++----- .../org/apache/spark/sql/errors/QueryCompilationErrors.scala | 2 +- .../sql-tests/analyzer-results/postgreSQL/numeric.sql.out | 3 ++- .../resources/sql-tests/results/postgreSQL/numeric.sql.out | 3 ++- .../org/apache/spark/sql/hive/execution/HiveQuerySuite.scala | 3 ++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/core/src/main/resources/error/error-classes.json b/core/src/main/resources/error/error-classes.json index abb843d519f..88740ca66ff 100644 --- a/core/src/main/resources/error/error-classes.json +++ b/core/src/main/resources/error/error-classes.json @@ -783,6 +783,12 @@ ], "sqlState" : "42704" }, + "INSERT_COLUMN_ARITY_MISMATCH" : { + "message" : [ + "<tableName> requires that the data to be inserted have the same number of columns as the target table: target table has <targetColumns> column(s) but the inserted data has <insertedColumns> column(s), including <staticPartCols> partition column(s) having constant value(s)." + ], + "sqlState" : "21S01" + }, "INTERNAL_ERROR" : { "message" : [ "<message>" @@ -2969,11 +2975,6 @@ "Bucket sorting column '<sortCol>' should not be part of partition columns '<normalizedPartCols>'." ] }, - "_LEGACY_ERROR_TEMP_1168" : { - "message" : [ - "<tableName> requires that the data to be inserted have the same number of columns as the target table: target table has <targetColumns> column(s) but the inserted data has <insertedColumns> column(s), including <staticPartCols> partition column(s) having constant value(s)." - ] - }, "_LEGACY_ERROR_TEMP_1169" : { "message" : [ "Requested partitioning does not match the table <tableName>:", diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala index e1a09a4f843..e332e95c50d 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala @@ -1717,7 +1717,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase { def mismatchedInsertedDataColumnNumberError( tableName: String, insert: InsertIntoStatement, staticPartCols: Set[String]): Throwable = { new AnalysisException( - errorClass = "_LEGACY_ERROR_TEMP_1168", + errorClass = "INSERT_COLUMN_ARITY_MISMATCH", messageParameters = Map( "tableName" -> tableName, "targetColumns" -> insert.table.output.size.toString, diff --git a/sql/core/src/test/resources/sql-tests/analyzer-results/postgreSQL/numeric.sql.out b/sql/core/src/test/resources/sql-tests/analyzer-results/postgreSQL/numeric.sql.out index 7c4ffa76710..d32e2abe156 100644 --- a/sql/core/src/test/resources/sql-tests/analyzer-results/postgreSQL/numeric.sql.out +++ b/sql/core/src/test/resources/sql-tests/analyzer-results/postgreSQL/numeric.sql.out @@ -3841,7 +3841,8 @@ INSERT INTO num_result SELECT t1.id, t2.id, t1.val, t2.val, t1.val * t2.val -- !query analysis org.apache.spark.sql.AnalysisException { - "errorClass" : "_LEGACY_ERROR_TEMP_1168", + "errorClass" : "INSERT_COLUMN_ARITY_MISMATCH", + "sqlState" : "21S01", "messageParameters" : { "insertedColumns" : "5", "staticPartCols" : "0", diff --git a/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out b/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out index 8e63191a803..db81160bf03 100644 --- a/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out @@ -3832,7 +3832,8 @@ struct<> -- !query output org.apache.spark.sql.AnalysisException { - "errorClass" : "_LEGACY_ERROR_TEMP_1168", + "errorClass" : "INSERT_COLUMN_ARITY_MISMATCH", + "sqlState" : "21S01", "messageParameters" : { "insertedColumns" : "5", "staticPartCols" : "0", diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala index 9da94223dfb..10f18a9ef2e 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveQuerySuite.scala @@ -1258,7 +1258,8 @@ class HiveQuerySuite extends HiveComparisonTest with SQLTestUtils with BeforeAnd """INSERT INTO TABLE dp_test PARTITION(dp) |SELECT key, value, key % 5 FROM src""".stripMargin) }, - errorClass = "_LEGACY_ERROR_TEMP_1168", + errorClass = "INSERT_COLUMN_ARITY_MISMATCH", + sqlState = "21S01", parameters = Map( "tableName" -> "`spark_catalog`.`default`.`dp_test`", "targetColumns" -> "4", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org