Skip to content

[SPARK-43204][SQL] Align MERGE assignments with table attributes#40919

Closed
aokolnychyi wants to merge 1 commit into
apache:masterfrom
aokolnychyi:spark-43204
Closed

[SPARK-43204][SQL] Align MERGE assignments with table attributes#40919
aokolnychyi wants to merge 1 commit into
apache:masterfrom
aokolnychyi:spark-43204

Conversation

@aokolnychyi

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR extends ResolveRowLevelCommandAssignments to also cover MERGE assignments.

Why are the changes needed?

Similar to SPARK-42151, these changes are needed so that we can rewrite MERGE statements into executable plans for tables that support row-level operations. In particular, our row-level mutation framework assumes Spark is responsible for building an updated version of each affected row and that row is passed back to the data source.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

This PR comes with tests.

@github-actions github-actions Bot added the SQL label Apr 23, 2023
"cols" -> cols))
}
resolved
resolved match {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change is needed as references to nested columns in MERGE are resolved like a.nested_col.i AS i (with added aliases), which breaks our assumption about what kind of keys we expect. Let me know if anyone can spot any edge cases when it is not safe.

@aokolnychyi

Copy link
Copy Markdown
Contributor Author

@cloud-fan @sunchao @viirya @huaxingao @dongjoon-hyun @gengliangwang, this is a follow-up to PR #40308.

@cloud-fan

Copy link
Copy Markdown
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 331e5bb Apr 25, 2023
@aokolnychyi

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing, @cloud-fan!

viirya pushed a commit to viirya/spark-1 that referenced this pull request Oct 19, 2023
### What changes were proposed in this pull request?

This PR extends `ResolveRowLevelCommandAssignments` to also cover MERGE assignments.

### Why are the changes needed?

Similar to SPARK-42151, these changes are needed so that we can rewrite MERGE statements into executable plans for tables that support row-level operations. In particular, our row-level mutation framework assumes Spark is responsible for building an updated version of each affected row and that row is passed back to the data source.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

This PR comes with tests.

Closes apache#40919 from aokolnychyi/spark-43204.

Authored-by: aokolnychyi <aokolnychyi@apple.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 331e5bb)
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.

2 participants