Skip to content

[spark] Narrow cached source columns in shared Data Evolution MERGE joins - #11496

Open
JustinBinber wants to merge 6 commits into
apache:masterfrom
JustinBinber:codex/merge-narrow-source-resubmitted
Open

JustinBinber wants to merge 6 commits into
apache:masterfrom
JustinBinber:codex/merge-narrow-source-resubmitted

Conversation

@JustinBinber

@JustinBinber JustinBinber commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #11323

Follow-up to #11322

@JingsongLi, thank you for rerunning the 17 MERGE tests on Spark 3.5.9 and 4.1.4 and for reproducing the same-ID rollback case in your review. This resubmission carries forward the fix discussed there and is based on a fresh master snapshot.

  • In the rollback reproducer, a rollback and new commit reused a snapshot ID between the shared join and the INSERT reread. Both reads now use the original resolved Snapshot and its manifest references. Missing original files fail the MERGE before target commit. Sources configured to skip missing or corrupt files use the existing wide shared path. The previous fix and regression notes have the full details.
  • The JDK setup retry is tracked separately in [ci] Retry a failed JDK setup once #11495. This PR contains the MERGE implementation, tests, and option documentation.

Behavior and benchmark

The default-off option keeps INSERT-only wide columns out of the shared join cache. Eligible Paimon append sources are pinned, and INSERT rereads the source with null-safe key membership. The reread still scans the source. Unsupported sources and plans fall back to the existing shared path.

On the fixed wide-field workload with about 90% INSERT, existing sharing versus narrowing used 316.79 vs 10.77 MB of shuffle and 312.20 vs 18.78 MB peak disk cache. Full SQL took 76.95 vs 72.63 s, with sampled RSS rising from 3.78 to 4.80 GiB. These are one-sample screening measurements per configuration on a single host, from the earlier feature revision. The public reproduction bundle includes SQL, input generation, results, and the all-INSERT and no-wide-field controls.

Validation

CI passed on the prior fixed revision. The regression suite includes rollback with a reused ID and schema and fallback for sources that skip unavailable files. This revision has its own CI run.

The full 19-test regression suite also passed locally on Linux with Spark 3.5.9, Scala 2.13, and Temurin 8 on this revision.

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I ran all 19 narrow-source MERGE tests on Spark 3.5.9 and all 19 on Spark 4.1.4. The optimization addresses the measured shuffle and disk-cache cost for wide INSERT payloads. An additional Spark 4.1.4 SQL test reproduced a result change for cached source tables.

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The 22 focused Spark cases passed. A separate MERGE reproduction failed when narrowing pinned a source with reader-level latest-delta options.

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.

[Feature] Reduce INSERT-only payload shuffle and caching in Spark Data Evolution MERGE

2 participants