This is an automated email from the ASF dual-hosted git repository.
Yicong-Huang 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 2acd4b6cbfd7 [SPARK-58228][SQL] Convert unreachable error condition
_LEGACY_ERROR_TEMP_1058 to an internal error
2acd4b6cbfd7 is described below
commit 2acd4b6cbfd7f83f19cdfc2b95806a440298645d
Author: Matthew B. <[email protected]>
AuthorDate: Fri Aug 14 19:37:57 2026 +0000
[SPARK-58228][SQL] Convert unreachable error condition
_LEGACY_ERROR_TEMP_1058 to an internal error
### What changes were proposed in this pull request?
Convert `_LEGACY_ERROR_TEMP_1058` (raised in `ResolveSessionCatalog` when a
table has both `USING` and a Hive SerDe) into a `SparkException.internalError`,
and remove the condition from `error-conditions.json` plus its now-unused
`QueryCompilationErrors` helper.
Part of [SPARK-37935](https://issues.apache.org/jira/browse/SPARK-37935).
### Why are the changes needed?
This branch is unreachable by users: the parser rejects `USING` + `STORED
AS`/`ROW FORMAT` before analysis, and no DataFrame/Catalog API sets SerDe info.
It can only fire if an invalid plan is built internally, so it is a bug guard,
not a user error. Naming it as a user-facing condition would misclassify it;
`internalError` is the correct classification.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
No new test (the path is unreachable from SQL). Existing `DDLParserSuite`
(parser rejection) and `SparkThrowableSuite` (error-catalog consistency) pass.
### Was this patch authored or co-authored using generative AI tooling?
Discovered-with: Claude Opus 4.8
Closes #57384 from Ma77Ball/assign-name-legacy-error-1058.
Authored-by: Matthew B. <[email protected]>
Signed-off-by: Yicong-Huang <[email protected]>
---
common/utils/src/main/resources/error/error-conditions.json | 5 -----
.../org/apache/spark/sql/errors/QueryCompilationErrors.scala | 9 ---------
.../spark/sql/catalyst/analysis/ResolveSessionCatalog.scala | 5 +++--
3 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/common/utils/src/main/resources/error/error-conditions.json
b/common/utils/src/main/resources/error/error-conditions.json
index ce50ffb1f2eb..4e367907d75c 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -10025,11 +10025,6 @@
"ADD COLUMN with v1 tables cannot specify NOT NULL."
]
},
- "_LEGACY_ERROR_TEMP_1058" : {
- "message" : [
- "Cannot create table with both USING <provider> and <serDeInfo>."
- ]
- },
"_LEGACY_ERROR_TEMP_1059" : {
"message" : [
"STORED AS with file format '<serdeInfo>' is invalid."
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 13006cebc97d..42351b07a688 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
@@ -1324,15 +1324,6 @@ private[sql] object QueryCompilationErrors extends
QueryErrorsBase with Compilat
"namespaceB" -> toSQLId(namespaceB)))
}
- def cannotCreateTableWithBothProviderAndSerdeError(
- provider: Option[String], maybeSerdeInfo: Option[SerdeInfo]): Throwable
= {
- new AnalysisException(
- errorClass = "_LEGACY_ERROR_TEMP_1058",
- messageParameters = Map(
- "provider" -> provider.toString,
- "serDeInfo" -> maybeSerdeInfo.get.describe))
- }
-
def invalidFileFormatForStoredAsError(serdeInfo: SerdeInfo): Throwable = {
new AnalysisException(
errorClass = "_LEGACY_ERROR_TEMP_1059",
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 01f39e60afd3..e6fc6d8d862c 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
@@ -762,8 +762,9 @@ class ResolveSessionCatalog(val catalogManager:
CatalogManager)
if (provider.isDefined) {
// The parser guarantees that USING and STORED AS/ROW FORMAT won't
co-exist.
if (maybeSerdeInfo.isDefined) {
- throw
QueryCompilationErrors.cannotCreateTableWithBothProviderAndSerdeError(
- provider, maybeSerdeInfo)
+ throw SparkException.internalError(
+ s"Cannot create table with both USING ${provider.get} and " +
+ s"${maybeSerdeInfo.get.describe}")
}
(nonHiveStorageFormat, provider.get)
} else if (maybeSerdeInfo.isDefined) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]