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

MaxGekk pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new 5a398e63493e [SPARK-44800][SQL] Assign names to legacy error classes
5a398e63493e is described below

commit 5a398e63493ecef497b9d143991d190cc70a0ffb
Author: michaelmitchell-bit <[email protected]>
AuthorDate: Tue Jun 30 10:16:57 2026 +0200

    [SPARK-44800][SQL] Assign names to legacy error classes
    
    ### What changes were proposed in this pull request?
    
    This PR assigns named error conditions and SQLSTATEs for the remaining 
SPARK-44800 legacy error classes that still exist on master:
    
    - `_LEGACY_ERROR_TEMP_1017` -> `EXPECT_PERSISTENT_FUNCTION_NOT_TEMP`
    - `_LEGACY_ERROR_TEMP_1073` -> 
`RENAME_TABLE_SOURCE_DESTINATION_DATABASE_MISMATCH`
    - `_LEGACY_ERROR_TEMP_1074` -> `RENAME_TEMP_VIEW_WITH_DATABASE`
    - `_LEGACY_ERROR_TEMP_1076` -> `INVALID_PARTITION_SPEC`
    - `_LEGACY_ERROR_TEMP_1126` -> 
`NESTED_DATABASE_UNSUPPORTED_BY_V1_SESSION_CATALOG`
    
    `_LEGACY_ERROR_TEMP_1125` has already been migrated to 
`MISSING_DATABASE_FOR_V1_SESSION_CATALOG`.
    
    ### Why are the changes needed?
    
    To replace temporary legacy error classes with stable named error 
conditions and SQLSTATEs.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes. The affected errors now report named error conditions and SQLSTATEs. 
The rename-table, rename-temp-view, and nested-database v1 catalog errors also 
format identifiers with SQL identifier quoting.
    
    ### How was this patch tested?
    
    Ran targeted tests:
    
    ```
    ./build/sbt "core/testOnly org.apache.spark.SparkThrowableSuite"
    ./build/sbt "sql/testOnly org.apache.spark.sql.FunctionQualificationSuite 
-- -z SPARK-44800"
    ./build/sbt "catalyst/testOnly 
org.apache.spark.sql.catalyst.catalog.InMemorySessionCatalogSuite -- -z invalid"
    ./build/sbt "sql/testOnly 
org.apache.spark.sql.execution.command.v1.AlterTableRenameSuite -- -z 
\"destination database is different\""
    ./build/sbt "sql/testOnly 
org.apache.spark.sql.execution.command.InMemoryCatalogedDDLSuite -- -z \"rename 
temporary view - destination table with database name\""
    ./build/sbt "sql/testOnly 
org.apache.spark.sql.execution.command.v1.AlterTableAddPartitionSuite 
org.apache.spark.sql.execution.command.v1.AlterTableDropPartitionSuite -- -z 
\"empty string as partition value\""
    ./build/sbt "sql/testOnly 
org.apache.spark.sql.execution.command.v1.ShowTablesSuite -- -z \"only support 
single-level namespace\""
    ./build/sbt "sql/testOnly 
org.apache.spark.sql.connector.DataSourceV2SQLSuiteV1Filter 
org.apache.spark.sql.connector.DataSourceV2SQLSuiteV2Filter -- -z \"ShowViews: 
using v1 catalog\""
    ./build/sbt "sql/testOnly org.apache.spark.sql.sources.InsertSuite -- -z 
\"Disallow empty part col values\""
    ./build/sbt "hive/testOnly 
org.apache.spark.sql.hive.HiveExternalSessionCatalogSuite -- -z invalid"
    ./build/sbt "hive/testOnly org.apache.spark.sql.hive.InsertSuite -- -z 
\"Disallow empty part col values\""
    ./build/sbt "hive/testOnly org.apache.spark.sql.hive.execution.HiveDDLSuite 
-- -z SPARK-19129"
    ```
    
    Also ran:
    
    ```
    jq empty common/utils/src/main/resources/error/error-conditions.json
    git diff --check
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: OpenAI Codex
    
    Closes #56880 from 
michaelmitchell-bit/SPARK-44800-name-legacy-error-classes.
    
    Authored-by: michaelmitchell-bit <[email protected]>
    Signed-off-by: Max Gekk <[email protected]>
    (cherry picked from commit aa784b05cc5454977bb884936594890410981429)
    Signed-off-by: Max Gekk <[email protected]>
---
 .../src/main/resources/error/error-conditions.json | 55 ++++++++++++----------
 .../spark/sql/errors/QueryCompilationErrors.scala  | 30 ++++++------
 .../sql/catalyst/catalog/SessionCatalogSuite.scala | 26 +++++-----
 .../catalyst/analysis/ResolveSessionCatalog.scala  |  4 +-
 .../spark/sql/FunctionQualificationSuite.scala     | 26 ++++++++++
 .../spark/sql/connector/DataSourceV2SQLSuite.scala |  4 +-
 .../spark/sql/execution/command/DDLSuite.scala     |  8 ++--
 .../command/v1/AlterTableAddPartitionSuite.scala   |  2 +-
 .../command/v1/AlterTableDropPartitionSuite.scala  |  2 +-
 .../command/v1/AlterTableRenameSuite.scala         |  4 +-
 .../sql/execution/command/v1/ShowTablesSuite.scala |  4 +-
 .../org/apache/spark/sql/sources/InsertSuite.scala |  4 +-
 .../org/apache/spark/sql/hive/InsertSuite.scala    |  2 +-
 .../spark/sql/hive/execution/HiveDDLSuite.scala    |  2 +-
 14 files changed, 102 insertions(+), 71 deletions(-)

diff --git a/common/utils/src/main/resources/error/error-conditions.json 
b/common/utils/src/main/resources/error/error-conditions.json
index 868781eac8a2..fb47a9d8951c 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -2403,6 +2403,12 @@
     ],
     "sqlState" : "42809"
   },
+  "EXPECT_PERSISTENT_FUNCTION_NOT_TEMP" : {
+    "message" : [
+      "<functionName> is a temporary function. '<operation>' expects a 
persistent function.<alternative>"
+    ],
+    "sqlState" : "42809"
+  },
   "EXPECT_TABLE_NOT_VIEW" : {
     "message" : [
       "'<operation>' expects a table but <viewName> is a view."
@@ -4608,6 +4614,12 @@
     },
     "sqlState" : "42601"
   },
+  "INVALID_PARTITION_SPEC" : {
+    "message" : [
+      "Partition spec is invalid. <details>."
+    ],
+    "sqlState" : "42601"
+  },
   "INVALID_PARTITION_VALUE" : {
     "message" : [
       "Failed to cast value <value> to data type <dataType> for partition 
column <columnName>. Ensure the value matches the expected data type for this 
partition column."
@@ -5701,6 +5713,12 @@
     ],
     "sqlState" : "42607"
   },
+  "NESTED_DATABASE_UNSUPPORTED_BY_V1_SESSION_CATALOG" : {
+    "message" : [
+      "Nested databases are not supported by v1 session catalog: <namespace>."
+    ],
+    "sqlState" : "42K05"
+  },
   "NESTED_EXECUTE_IMMEDIATE" : {
     "message" : [
       "Nested EXECUTE IMMEDIATE commands are not allowed. Please ensure that 
the SQL query provided (<sqlString>) does not contain another EXECUTE IMMEDIATE 
command."
@@ -6397,6 +6415,18 @@
     ],
     "sqlState" : "42K03"
   },
+  "RENAME_TABLE_SOURCE_DESTINATION_DATABASE_MISMATCH" : {
+    "message" : [
+      "RENAME TABLE source and destination databases do not match: <db> != 
<newDb>."
+    ],
+    "sqlState" : "3F000"
+  },
+  "RENAME_TEMP_VIEW_WITH_DATABASE" : {
+    "message" : [
+      "RENAME TEMPORARY VIEW from <oldName> to <newName>: cannot specify 
database name <db> in the destination table."
+    ],
+    "sqlState" : "42809"
+  },
   "REPEATED_CLAUSE" : {
     "message" : [
       "The <clause> clause may be used at most once per <operation> operation."
@@ -9320,11 +9350,6 @@
       "Cannot write into v1 table: <identifier>."
     ]
   },
-  "_LEGACY_ERROR_TEMP_1017" : {
-    "message" : [
-      "<name> is a temporary function. '<cmd>' expects a persistent 
function.<hintStr>"
-    ]
-  },
   "_LEGACY_ERROR_TEMP_1018" : {
     "message" : [
       "<quoted> is a permanent view, which is not supported by streaming 
reading API such as `DataStreamReader.table` yet."
@@ -9441,21 +9466,6 @@
       "Only the tables/views belong to the same database can be retrieved. 
Querying tables/views are <qualifiedTableNames>."
     ]
   },
-  "_LEGACY_ERROR_TEMP_1073" : {
-    "message" : [
-      "RENAME TABLE source and destination databases do not match: '<db>' != 
'<newDb>'."
-    ]
-  },
-  "_LEGACY_ERROR_TEMP_1074" : {
-    "message" : [
-      "RENAME TEMPORARY VIEW from '<oldName>' to '<newName>': cannot specify 
database name '<db>' in the destination table."
-    ]
-  },
-  "_LEGACY_ERROR_TEMP_1076" : {
-    "message" : [
-      "Partition spec is invalid. <details>."
-    ]
-  },
   "_LEGACY_ERROR_TEMP_1079" : {
     "message" : [
       "Resource Type '<resourceType>' is not supported."
@@ -9548,11 +9558,6 @@
       "Cannot rename a table with ALTER VIEW. Please use ALTER TABLE instead."
     ]
   },
-  "_LEGACY_ERROR_TEMP_1126" : {
-    "message" : [
-      "Nested databases are not supported by v1 session catalog: <catalog>."
-    ]
-  },
   "_LEGACY_ERROR_TEMP_1127" : {
     "message" : [
       "Invalid partitionExprs specified: <sortOrders> For range partitioning 
use REPARTITION_BY_RANGE instead."
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 b5db2ba8e886..1259feae30d4 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
@@ -744,13 +744,13 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
 
   def expectPersistentFuncError(
       name: String, cmd: String, mismatchHint: Option[String], t: 
TreeNode[_]): Throwable = {
-    val hintStr = mismatchHint.map(" " + _).getOrElse("")
+    val alternative = mismatchHint.map(" " + _).getOrElse("")
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1017",
+      errorClass = "EXPECT_PERSISTENT_FUNCTION_NOT_TEMP",
       messageParameters = Map(
-        "name" -> name,
-        "cmd" -> cmd,
-        "hintStr" -> hintStr),
+        "functionName" -> toSQLId(name),
+        "operation" -> toSQLStmt(cmd),
+        "alternative" -> alternative),
       origin = t.origin)
   }
 
@@ -1375,18 +1375,18 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
 
   def renameTableSourceAndDestinationMismatchError(db: String, newDb: String): 
Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1073",
-      messageParameters = Map("db" -> db, "newDb" -> newDb))
+      errorClass = "RENAME_TABLE_SOURCE_DESTINATION_DATABASE_MISMATCH",
+      messageParameters = Map("db" -> toSQLId(db), "newDb" -> toSQLId(newDb)))
   }
 
   def cannotRenameTempViewWithDatabaseSpecifiedError(
       oldName: TableIdentifier, newName: TableIdentifier): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1074",
+      errorClass = "RENAME_TEMP_VIEW_WITH_DATABASE",
       messageParameters = Map(
-        "oldName" -> oldName.toString,
-        "newName" -> newName.toString,
-        "db" -> newName.database.get))
+        "oldName" -> toSQLId(oldName.nameParts),
+        "newName" -> toSQLId(newName.nameParts),
+        "db" -> toSQLId(newName.database.get)))
   }
 
   def cannotRenameTempViewToExistingTableError(newName: TableIdentifier): 
Throwable = {
@@ -1395,7 +1395,7 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
 
   def invalidPartitionSpecError(details: String): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1076",
+      errorClass = "INVALID_PARTITION_SPEC",
       messageParameters = Map("details" -> details))
   }
 
@@ -1867,10 +1867,10 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase with Compilat
       messageParameters = Map.empty)
   }
 
-  def nestedDatabaseUnsupportedByV1SessionCatalogError(catalog: String): 
Throwable = {
+  def nestedDatabaseUnsupportedByV1SessionCatalogError(namespace: 
Seq[String]): Throwable = {
     new AnalysisException(
-      errorClass = "_LEGACY_ERROR_TEMP_1126",
-      messageParameters = Map("catalog" -> catalog))
+      errorClass = "NESTED_DATABASE_UNSUPPORTED_BY_V1_SESSION_CATALOG",
+      messageParameters = Map("namespace" -> toSQLId(namespace)))
   }
 
   def invalidRepartitionExpressionsError(sortOrders: Seq[Any]): Throwable = {
diff --git 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalogSuite.scala
 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalogSuite.scala
index 1106da4518ed..2c37cda406b8 100644
--- 
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalogSuite.scala
+++ 
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalogSuite.scala
@@ -1154,7 +1154,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
             TableIdentifier("tbl2", Some("db2")),
             Seq(partWithEmptyValue, part1), ignoreIfExists = true)
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
@@ -1247,7 +1247,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
             purge = false,
             retainData = false)
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec (a, b, c) must be contained within the 
partition " +
             s"spec (a, b) defined in table 
'`$SESSION_CATALOG_NAME`.`db2`.`tbl2`'")))
@@ -1260,7 +1260,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
             purge = false,
             retainData = false)
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec (a, unknown) must be contained within the 
partition " +
             s"spec (a, b) defined in table 
'`$SESSION_CATALOG_NAME`.`db2`.`tbl2`'")))
@@ -1273,7 +1273,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
             purge = false,
             retainData = false)
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
@@ -1340,7 +1340,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
         exception = intercept[AnalysisException] {
           catalog.getPartition(TableIdentifier("tbl1", Some("db2")), 
partWithEmptyValue.spec)
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
@@ -1431,7 +1431,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
             TableIdentifier("tbl1", Some("db2")),
             Seq(part1.spec), Seq(partWithEmptyValue.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
@@ -1512,7 +1512,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
         exception = intercept[AnalysisException] {
           catalog.alterPartitions(TableIdentifier("tbl1", Some("db2")), 
Seq(partWithEmptyValue))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
@@ -1544,7 +1544,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
           catalog.listPartitionNames(TableIdentifier("tbl2", Some("db2")),
             Some(partWithMoreColumns.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec (a, b, c) must be contained within the 
partition spec (a, b) " +
             s"defined in table '`$SESSION_CATALOG_NAME`.`db2`.`tbl2`'")))
@@ -1553,7 +1553,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
           catalog.listPartitionNames(TableIdentifier("tbl2", Some("db2")),
             Some(partWithUnknownColumns.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec (a, unknown) must be contained within the 
partition " +
             s"spec (a, b) defined in table 
'`$SESSION_CATALOG_NAME`.`db2`.`tbl2`'")))
@@ -1562,7 +1562,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
           catalog.listPartitionNames(TableIdentifier("tbl2", Some("db2")),
             Some(partWithEmptyValue.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
@@ -1592,7 +1592,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
           catalog.listPartitions(TableIdentifier("tbl2", Some("db2")),
             Some(partWithMoreColumns.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec (a, b, c) must be contained within the 
partition spec (a, b) " +
             s"defined in table '`$SESSION_CATALOG_NAME`.`db2`.`tbl2`'")))
@@ -1601,7 +1601,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
           catalog.listPartitions(TableIdentifier("tbl2", Some("db2")),
             Some(partWithUnknownColumns.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec (a, unknown) must be contained within the 
partition " +
             s"spec (a, b) defined in table 
'`$SESSION_CATALOG_NAME`.`db2`.`tbl2`'")))
@@ -1610,7 +1610,7 @@ abstract class SessionCatalogSuite extends AnalysisTest 
with Eventually {
           catalog.listPartitions(TableIdentifier("tbl2", Some("db2")),
             Some(partWithEmptyValue.spec))
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([a=3, b=]) contains an empty partition 
column value"))
     }
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
index 969adc073186..8d483bb0c95b 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala
@@ -953,7 +953,7 @@ class ResolveSessionCatalog(val catalogManager: 
CatalogManager)
       case _ =>
         assert(resolved.namespace.length > 1)
         throw 
QueryCompilationErrors.nestedDatabaseUnsupportedByV1SessionCatalogError(
-          resolved.namespace.map(quoteIfNeeded).mkString("."))
+          resolved.namespace)
     }
   }
 
@@ -967,7 +967,7 @@ class ResolveSessionCatalog(val catalogManager: 
CatalogManager)
       case _ =>
         assert(resolved.namespace.length > 1)
         throw 
QueryCompilationErrors.nestedDatabaseUnsupportedByV1SessionCatalogError(
-          resolved.namespace.map(quoteIfNeeded).mkString("."))
+          resolved.namespace)
     }
   }
 
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/FunctionQualificationSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/FunctionQualificationSuite.scala
index 3aade2ddf09a..36b43b196436 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/FunctionQualificationSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/FunctionQualificationSuite.scala
@@ -418,6 +418,32 @@ class FunctionQualificationSuite extends 
SharedSparkSession {
     )
   }
 
+  test("SPARK-44800: Error Cases - DROP FUNCTION expects a persistent 
function") {
+    sql("CREATE TEMPORARY FUNCTION drop_persistent_test() RETURNS INT RETURN 
1")
+    val sqlText = "DROP FUNCTION drop_persistent_test"
+    try {
+      checkError(
+        exception = intercept[AnalysisException] {
+          sql(sqlText)
+        },
+        condition = "EXPECT_PERSISTENT_FUNCTION_NOT_TEMP",
+        sqlState = "42809",
+        parameters = Map(
+          "functionName" -> "`drop_persistent_test`",
+          "operation" -> "DROP FUNCTION",
+          "alternative" -> " Please use DROP TEMPORARY FUNCTION to drop a 
temporary function."
+        ),
+        context = ExpectedContext(
+          fragment = sqlText,
+          start = 0,
+          stop = sqlText.length - 1
+        )
+      )
+    } finally {
+      sql("DROP TEMPORARY FUNCTION IF EXISTS drop_persistent_test")
+    }
+  }
+
   test("SECTION 7d: Error Cases - cannot create function in builtin namespace 
(CREATE FUNCTION)") {
     checkError(
       exception = intercept[AnalysisException] {
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
index c111bf0dc319..3c5d1626ca1f 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala
@@ -1434,8 +1434,8 @@ class DataSourceV2SQLSuiteV1Filter
   test("ShowViews: using v1 catalog, db name with multipartIdentifier ('a.b') 
is not allowed.") {
     checkError(
       exception = analysisException("SHOW VIEWS FROM a.b"),
-      condition = "_LEGACY_ERROR_TEMP_1126",
-      parameters = Map("catalog" -> "a.b"))
+      condition = "NESTED_DATABASE_UNSUPPORTED_BY_V1_SESSION_CATALOG",
+      parameters = Map("namespace" -> "`a`.`b`"))
   }
 
   test("ShowViews: using v2 catalog, command not supported.") {
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
index c4715b6a37ef..92e9dc1a2e59 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
@@ -822,11 +822,11 @@ abstract class DDLSuite extends QueryTest with 
DDLSuiteBase {
         exception = intercept[AnalysisException] {
           sql("ALTER TABLE tab1 RENAME TO default.tab2")
         },
-        condition = "_LEGACY_ERROR_TEMP_1074",
+        condition = "RENAME_TEMP_VIEW_WITH_DATABASE",
         parameters = Map(
           "oldName" -> "`tab1`",
           "newName" -> "`default`.`tab2`",
-          "db" -> "default")
+          "db" -> "`default`")
       )
 
       val catalog = spark.sessionState.catalog
@@ -851,11 +851,11 @@ abstract class DDLSuite extends QueryTest with 
DDLSuiteBase {
         exception = intercept[AnalysisException] {
           sql("ALTER TABLE view1 RENAME TO default.tab2")
         },
-        condition = "_LEGACY_ERROR_TEMP_1074",
+        condition = "RENAME_TEMP_VIEW_WITH_DATABASE",
         parameters = Map(
           "oldName" -> "`view1`",
           "newName" -> "`default`.`tab2`",
-          "db" -> "default"))
+          "db" -> "`default`"))
 
       val catalog = spark.sessionState.catalog
       assert(catalog.listTables("default") == Seq(TableIdentifier("view1")))
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableAddPartitionSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableAddPartitionSuite.scala
index 47ec09245130..58375ad11b06 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableAddPartitionSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableAddPartitionSuite.scala
@@ -43,7 +43,7 @@ trait AlterTableAddPartitionSuiteBase extends 
command.AlterTableAddPartitionSuit
         exception = intercept[AnalysisException] {
           sql(s"ALTER TABLE $t ADD PARTITION (p1 = '')")
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([p1=]) contains an empty partition column 
value"
         )
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableDropPartitionSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableDropPartitionSuite.scala
index 384aadfb3a6f..d991df997513 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableDropPartitionSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableDropPartitionSuite.scala
@@ -83,7 +83,7 @@ class AlterTableDropPartitionSuite
         exception = intercept[AnalysisException] {
           sql(s"ALTER TABLE $t DROP PARTITION (p1 = '')")
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map("details" -> "The spec ([p1=]) contains an empty 
partition column value")
       )
     }
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableRenameSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableRenameSuite.scala
index f8708d5bff25..88772d5ef146 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableRenameSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/AlterTableRenameSuite.scala
@@ -41,8 +41,8 @@ trait AlterTableRenameSuiteBase extends 
command.AlterTableRenameSuiteBase with Q
           exception = intercept[AnalysisException] {
             sql(s"ALTER TABLE $src RENAME TO dst_ns.dst_tbl")
           },
-          condition = "_LEGACY_ERROR_TEMP_1073",
-          parameters = Map("db" -> "src_ns", "newDb" -> "dst_ns")
+          condition = "RENAME_TABLE_SOURCE_DESTINATION_DATABASE_MISMATCH",
+          parameters = Map("db" -> "`src_ns`", "newDb" -> "`dst_ns`")
         )
       }
     }
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala
index 3928f63fe246..f50dbb6a10e2 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowTablesSuite.scala
@@ -57,8 +57,8 @@ trait ShowTablesSuiteBase extends command.ShowTablesSuiteBase 
with command.Tests
       exception = intercept[AnalysisException] {
         runShowTablesSql("SHOW TABLES FROM a.b", Seq())
       },
-      condition = "_LEGACY_ERROR_TEMP_1126",
-      parameters = Map("catalog" -> "a.b")
+      condition = "NESTED_DATABASE_UNSUPPORTED_BY_V1_SESSION_CATALOG",
+      parameters = Map("namespace" -> "`a`.`b`")
     )
   }
 
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
index 8d2418c5e052..c790dc1d04c9 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala
@@ -2615,7 +2615,7 @@ class InsertSuite extends DataSourceTest with 
SharedSparkSession {
         exception = intercept[AnalysisException] {
           sql("INSERT INTO TABLE insertTable PARTITION(part1=1, part2='') 
SELECT 1")
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec ([part1=Some(1), part2=Some()]) " +
             "contains an empty partition column value"))
@@ -2624,7 +2624,7 @@ class InsertSuite extends DataSourceTest with 
SharedSparkSession {
         exception = intercept[AnalysisException] {
           sql("INSERT INTO TABLE insertTable PARTITION(part1='', part2) SELECT 
1 ,'' AS part2")
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> ("The spec ([part1=Some(), part2=None]) " +
             "contains an empty partition column value"))
diff --git 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertSuite.scala 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertSuite.scala
index bd2b256e4927..b6f20c42f543 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/InsertSuite.scala
@@ -910,7 +910,7 @@ class InsertSuite extends QueryTest with TestHiveSingleton 
with BeforeAndAfter {
               |SELECT 1
             """.stripMargin)
         },
-        condition = "_LEGACY_ERROR_TEMP_1076",
+        condition = "INVALID_PARTITION_SPEC",
         parameters = Map(
           "details" -> "The spec ([d=Some()]) contains an empty partition 
column value")
       )
diff --git 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
index 8818983274ca..6ce4e8702c32 100644
--- 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
+++ 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
@@ -610,7 +610,7 @@ class HiveDDLSuite
       exception = intercept[AnalysisException] {
         sql(sql1)
       },
-      condition = "_LEGACY_ERROR_TEMP_1076",
+      condition = "INVALID_PARTITION_SPEC",
       parameters = Map(
         "details" -> "The spec ([partCol1=]) contains an empty partition 
column value")
     )


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

Reply via email to