Skip to content

[spark] Fix exprId mismatch in MERGE INTO by constructing Join plan directly#7624

Open
Zouxxyy wants to merge 1 commit intoapache:masterfrom
Zouxxyy:dev/merge-fix
Open

[spark] Fix exprId mismatch in MERGE INTO by constructing Join plan directly#7624
Zouxxyy wants to merge 1 commit intoapache:masterfrom
Zouxxyy:dev/merge-fix

Conversation

@Zouxxyy
Copy link
Copy Markdown
Contributor

@Zouxxyy Zouxxyy commented Apr 10, 2026

Purpose

Fix exprId mismatch bug in MERGE INTO when action expressions reference both source
and target columns (e.g., COALESCE(src.b, dest.b)).

Replace Dataset API join (sourceDS.join(targetDS, ...)) with manual Join plan node
construction, following the same pattern as Spark's RewriteMergeIntoTable. This
preserves original exprIds and eliminates the need for position-based rebinding.

Tests

Added 3 test cases in MergeIntoTableTestBase covering coalesce with dual-column
references: temp view source, Paimon table source, and subquery source.

…irectly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant