From 93a078128d4bc2bc7f762766f9d2338969a2be7f Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 24 Nov 2025 17:00:41 +0000 Subject: [PATCH 1/2] SPARK-54492 --- .../main/resources/error/error-conditions.json | 17 +++++++++-------- .../sql/errors/QueryCompilationErrors.scala | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/common/utils/src/main/resources/error/error-conditions.json b/common/utils/src/main/resources/error/error-conditions.json index 2017f1fc331e..11a046d1b266 100644 --- a/common/utils/src/main/resources/error/error-conditions.json +++ b/common/utils/src/main/resources/error/error-conditions.json @@ -7334,6 +7334,15 @@ ], "sqlState" : "P0001" }, + "USER_SPECIFIED_AND_ACTUAL_SCHEMA_MISMATCH" : { + "message" : [ + "The user-specified schema doesn't match the actual schema:", + "user-specified: , actual: . If you're using", + "DataFrameReader.schema API or creating a table, please do not specify the schema.", + "Or if you're scanning an existed table, please drop it and re-create it." + ], + "sqlState" : "42KD7" + }, "USER_SPECIFIED_AND_INFERRED_SCHEMA_NOT_COMPATIBLE" : { "message" : [ "Table '' has a user-specified schema that is incompatible with the schema", @@ -7916,14 +7925,6 @@ "A schema needs to be specified when using ." ] }, - "_LEGACY_ERROR_TEMP_1133" : { - "message" : [ - "The user-specified schema doesn't match the actual schema:", - "user-specified: , actual: . If you're using", - "DataFrameReader.schema API or creating a table, please do not specify the schema.", - "Or if you're scanning an existed table, please drop it and re-create it." - ] - }, "_LEGACY_ERROR_TEMP_1134" : { "message" : [ "Unable to infer schema for at . It must be specified manually." 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 77b775f6c49f..ef7b89bff77f 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 @@ -1726,7 +1726,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat def userSpecifiedSchemaMismatchActualSchemaError( schema: StructType, actualSchema: StructType): Throwable = { new AnalysisException( - errorClass = "_LEGACY_ERROR_TEMP_1133", + errorClass = "USER_SPECIFIED_AND_ACTUAL_SCHEMA_MISMATCH", messageParameters = Map( "schema" -> schema.toDDL, "actualSchema" -> actualSchema.toDDL)) From e1e994c0c1527749292424352c17b0628ba5a9fa Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 25 Nov 2025 09:37:13 +0000 Subject: [PATCH 2/2] Choose correst sqlState --- common/utils/src/main/resources/error/error-conditions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/src/main/resources/error/error-conditions.json b/common/utils/src/main/resources/error/error-conditions.json index 11a046d1b266..5e07aa71a186 100644 --- a/common/utils/src/main/resources/error/error-conditions.json +++ b/common/utils/src/main/resources/error/error-conditions.json @@ -7341,7 +7341,7 @@ "DataFrameReader.schema API or creating a table, please do not specify the schema.", "Or if you're scanning an existed table, please drop it and re-create it." ], - "sqlState" : "42KD7" + "sqlState" : "42K03" }, "USER_SPECIFIED_AND_INFERRED_SCHEMA_NOT_COMPATIBLE" : { "message" : [