From 77db7e727126eef44af44d435b6e01f8d5adfdd1 Mon Sep 17 00:00:00 2001 From: Matthew Ball Date: Sat, 12 Sep 2026 01:57:35 -0700 Subject: [PATCH] [SPARK-59437][SQL] Assign a name to the error condition _LEGACY_ERROR_1060 --- .../src/main/resources/error/error-conditions.json | 10 +++++----- .../spark/sql/errors/QueryCompilationErrors.scala | 2 +- .../spark/sql/connector/DataSourceV2SQLSuite.scala | 2 +- .../execution/command/DescribeTableSuiteBase.scala | 12 ++++++++---- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/common/utils/src/main/resources/error/error-conditions.json b/common/utils/src/main/resources/error/error-conditions.json index da25d3806c7b9..3c2c889e5f185 100644 --- a/common/utils/src/main/resources/error/error-conditions.json +++ b/common/utils/src/main/resources/error/error-conditions.json @@ -9129,6 +9129,11 @@ "The target JDBC server hosting table does not support ALTER TABLE with multiple actions. Split the ALTER TABLE up into individual actions to avoid this error." ] }, + "NESTED_COLUMN" : { + "message" : [ + " does not support nested column ``." + ] + }, "OBJECT_LEVEL_COLLATIONS" : { "message" : [ "Default collation for the specified object." @@ -10294,11 +10299,6 @@ "STORED AS with file format '' is invalid." ] }, - "_LEGACY_ERROR_TEMP_1060" : { - "message" : [ - " does not support nested column: ." - ] - }, "_LEGACY_ERROR_TEMP_1068" : { "message" : [ " is a system preserved database, you cannot use it as current database. To access global temporary views, you should use qualified name with the GLOBAL_TEMP_DATABASE, e.g. SELECT * FROM .viewName." 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 a4e8963b607f1..fa4db8a0fb064 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 @@ -1341,7 +1341,7 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase with Compilat def commandNotSupportNestedColumnError(command: String, quoted: String): Throwable = { new AnalysisException( - errorClass = "_LEGACY_ERROR_TEMP_1060", + errorClass = "UNSUPPORTED_FEATURE.NESTED_COLUMN", messageParameters = Map( "command" -> command, "column" -> quoted)) 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 bd2eb571da700..19eda2efbd9fb 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 @@ -341,7 +341,7 @@ class DataSourceV2SQLSuiteV1Filter sql(s"CREATE TABLE $t (d struct) USING foo") checkError( exception = analysisException(s"describe $t d.a"), - condition = "_LEGACY_ERROR_TEMP_1060", + condition = "UNSUPPORTED_FEATURE.NESTED_COLUMN", parameters = Map( "command" -> "DESC TABLE COLUMN", "column" -> "d.a")) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DescribeTableSuiteBase.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DescribeTableSuiteBase.scala index 398d17d20cf16..3ee1c8d63b56b 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DescribeTableSuiteBase.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DescribeTableSuiteBase.scala @@ -173,10 +173,14 @@ trait DescribeTableSuiteBase extends QueryTest with DDLCommandTestUtils { test("describe a nested column") { withNamespaceAndTable("ns", "tbl") { tbl => sql(s"CREATE TABLE $tbl (`a.b` int, col struct) $defaultUsing") - val errMsg = intercept[AnalysisException] { - sql(s"DESCRIBE TABLE $tbl col.x") - }.getMessage - assert(errMsg === "DESC TABLE COLUMN does not support nested column: col.x.") + checkError( + exception = intercept[AnalysisException] { + sql(s"DESCRIBE TABLE $tbl col.x") + }, + condition = "UNSUPPORTED_FEATURE.NESTED_COLUMN", + parameters = Map( + "command" -> "DESC TABLE COLUMN", + "column" -> "col.x")) } }