You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2025/11/25 01:43:02 UTC
(spark) branch branch-4.1 updated: [SPARK-54491][SQL] Fix insert into temp view on DSv2 table failure
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 5b1ce6d502be [SPARK-54491][SQL] Fix insert into temp view on DSv2 table failure
5b1ce6d502be is described below
commit 5b1ce6d502beb7ed85051e1140cc6dc08de2ec9b
Author: manuzhang <ow...@gmail.com>
AuthorDate: Mon Nov 24 17:42:43 2025 -0800
[SPARK-54491][SQL] Fix insert into temp view on DSv2 table failure
### What changes were proposed in this pull request?
Resolve `V2TableReference` for table in `InsertIntoStatement`.
### Why are the changes needed?
https://github.com/apache/spark/pull/52876 brought in `V2TableReference` which broke relation resolution for insert into temp view on DSv2 table.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Add UT.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #53196 from manuzhang/FIX-SPARK-54491.
Authored-by: manuzhang <ow...@gmail.com>
Signed-off-by: Dongjoon Hyun <do...@apache.org>
(cherry picked from commit 3f5a2b9fc3344b397320c8f507dd1ab9068e99d5)
Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
.../org/apache/spark/sql/catalyst/analysis/Analyzer.scala | 2 ++
.../apache/spark/sql/connector/DataSourceV2SQLSuite.scala | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
index 3b916a62b388..08c31939f161 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
@@ -1207,6 +1207,8 @@ class Analyzer(
val relation = table match {
case u: UnresolvedRelation if !u.isStreaming =>
resolveRelation(u).getOrElse(u)
+ case r: V2TableReference =>
+ relationResolution.resolveReference(r)
case other => other
}
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 847af570d6f3..5a9494cf8173 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
@@ -3986,6 +3986,19 @@ class DataSourceV2SQLSuiteV1Filter
}
}
+ test("SPARK-54491: insert into temp view on DSv2 table") {
+ val t = s"testcat.default.t"
+ val v = "v"
+ withTable(t) {
+ withTempView(v) {
+ sql(s"CREATE TABLE $t (id INT) USING foo")
+ spark.table(t).createOrReplaceTempView(v)
+ sql(s"INSERT INTO v VALUES (1)")
+ checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(1)))
+ }
+ }
+ }
+
private def testNotSupportedV2Command(
sqlCommand: String,
sqlParams: String,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org