Skip to content

Conversation

@manuzhang
Copy link
Member

@manuzhang manuzhang commented Nov 24, 2025

What changes were proposed in this pull request?

Resolve V2TableReference for table in InsertIntoStatement.

Why are the changes needed?

#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.

@github-actions github-actions bot added the SQL label Nov 24, 2025
@manuzhang
Copy link
Member Author

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you double-check Maven build failure, @manuzhang ?

Error: ] /home/runner/work/spark/spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:1194: not found: type V2TableReference
Error: ] /home/runner/work/spark/spark/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:1195: value resolveReference is not a member of org.apache.spark.sql.catalyst.analysis.RelationResolution

@dongjoon-hyun
Copy link
Member

cc @gengliangwang , too.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-54491] Fix insert into temp view on DSv2 table failure [SPARK-54491][SQL] Fix insert into temp view on DSv2 table failure Nov 25, 2025
val relation = table match {
case u: UnresolvedRelation if !u.isStreaming =>
resolveRelation(u).getOrElse(u)
case r: V2TableReference =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this ever be DataSourceV2Relation itself? I am asking primarily as there is resolveAsV2Relation that handles both below.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have ResolveInsertInto to handle it.

@dongjoon-hyun dongjoon-hyun self-assigned this Nov 25, 2025
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @manuzhang and @aokolnychyi .
Merged to master/4.1 for Apache Spark 4.1.0.

dongjoon-hyun pushed a commit that referenced this pull request Nov 25, 2025
### What changes were proposed in this pull request?
Resolve `V2TableReference` for table in `InsertIntoStatement`.

### Why are the changes needed?
#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 <owenzhang1990@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 3f5a2b9)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
@cloud-fan
Copy link
Contributor

good catch! late LGTM

@aokolnychyi
Copy link
Contributor

Thanks, @manuzhang!

huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
### What changes were proposed in this pull request?
Resolve `V2TableReference` for table in `InsertIntoStatement`.

### Why are the changes needed?
apache#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 apache#53196 from manuzhang/FIX-SPARK-54491.

Authored-by: manuzhang <owenzhang1990@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants