This is an automated email from the ASF dual-hosted git repository.
szehon-ho 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 156d0aa9f287 [SPARK-57764][SDP] Add missing error class
DUPLICATE_GRAPH_ELEMENT
156d0aa9f287 is described below
commit 156d0aa9f287ae496902f6e0ec6761eaa4b5a358
Author: Szehon Ho <[email protected]>
AuthorDate: Tue Jun 30 14:47:24 2026 -0700
[SPARK-57764][SDP] Add missing error class DUPLICATE_GRAPH_ELEMENT
### What changes were proposed in this pull request?
`DataflowGraph.mapUnique` throws the `DUPLICATE_GRAPH_ELEMENT` error class
when a graph contains duplicate element identifiers (outputs, tables, sinks,
views), but the error class was never registered in `error-conditions.json`.
This registers the error condition so it resolves correctly through the error
framework, and adds a test.
### Why are the changes needed?
The error class was used but not declared. Hitting this path raised
`INTERNAL_ERROR` ("Cannot find main error class 'DUPLICATE_GRAPH_ELEMENT'")
instead of the intended error.
### Does this PR introduce _any_ user-facing change?
No. Previously this code path raised an `INTERNAL_ERROR` because the error
class was unregistered; now the intended error message is produced.
### How was this patch tested?
Added a unit test in `ConnectInvalidPipelineSuite`. Also ran
`SparkThrowableSuite`.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Cursor (Claude Opus 4.8)
Closes #56874 from szehon-ho/SPARK-57764.
Authored-by: Szehon Ho <[email protected]>
Signed-off-by: Szehon Ho <[email protected]>
---
common/utils/src/main/resources/error/error-conditions.json | 6 ++++++
.../sql/pipelines/graph/ConnectInvalidPipelineSuite.scala | 11 +++++++++++
2 files changed, 17 insertions(+)
diff --git a/common/utils/src/main/resources/error/error-conditions.json
b/common/utils/src/main/resources/error/error-conditions.json
index c80447eab3d8..98a86f05fbd4 100644
--- a/common/utils/src/main/resources/error/error-conditions.json
+++ b/common/utils/src/main/resources/error/error-conditions.json
@@ -2261,6 +2261,12 @@
],
"sqlState" : "42710"
},
+ "DUPLICATE_GRAPH_ELEMENT" : {
+ "message" : [
+ "Found duplicate <graphElementType> '<graphElementName>'."
+ ],
+ "sqlState" : "42710"
+ },
"DUPLICATE_KEY" : {
"message" : [
"Found duplicate keys <keyColumn>."
diff --git
a/sql/pipelines/src/test/scala/org/apache/spark/sql/pipelines/graph/ConnectInvalidPipelineSuite.scala
b/sql/pipelines/src/test/scala/org/apache/spark/sql/pipelines/graph/ConnectInvalidPipelineSuite.scala
index 6eda2afdcdb8..62680ebd3835 100644
---
a/sql/pipelines/src/test/scala/org/apache/spark/sql/pipelines/graph/ConnectInvalidPipelineSuite.scala
+++
b/sql/pipelines/src/test/scala/org/apache/spark/sql/pipelines/graph/ConnectInvalidPipelineSuite.scala
@@ -764,4 +764,15 @@ class ConnectInvalidPipelineSuite extends PipelineTest
with SharedSparkSession {
)
)
}
+
+ test("DUPLICATE_GRAPH_ELEMENT: duplicate graph element identifiers") {
+ checkError(
+ exception = intercept[AnalysisException] {
+ DataflowGraph.mapUnique(Seq("a", "a"), "view")(identity)
+ },
+ condition = "DUPLICATE_GRAPH_ELEMENT",
+ parameters = Map(
+ "graphElementType" -> "view",
+ "graphElementName" -> "a"))
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]