Skip to content

Conversation

@97harsh
Copy link
Contributor

@97harsh 97harsh commented Jan 17, 2026

Summary

Changes

  • Added branch parameter to RewriteDataFilesProcedure for all three Spark versions
  • Added toBranch() method to RewriteDataFilesSparkAction for all three Spark versions
  • Branch resolution priority: explicit parameter > table branch > main branch
  • Added validation that target branch exists before rewriting
  • Backported all test cases from Spark:Add branch support to rewrite_data_files procedure #14964

Test plan

  • Run spotless
  • Run tests for Spark 4.0
  • Run tests for Spark 3.5
  • Run tests for Spark 3.4 (requires Java 8/11/17)

….5, and 3.4

This backports the branch support feature from Spark 4.1 (PR apache#14964) to Spark
4.0, 3.5, and 3.4. The changes add a new `branch` parameter to the
`rewrite_data_files` procedure that allows users to specify which branch to
compact data files for.

Key changes:
- Add `toBranch()` method to RewriteDataFilesSparkAction
- Add `branch` parameter to RewriteDataFilesProcedure
- Use branch snapshot ID instead of current snapshot for compaction
- Pass branch parameter to RewriteDataFilesCommitManager
….0, 3.5, and 3.4

Backport test cases from apache#14964:
- testRewriteDataFilesOnBranch
- testRewriteDataFilesToNullBranchFails
- testRewriteDataFilesOnBranchWithFilter
- testBranchCompactionDoesNotAffectMain
@github-actions github-actions bot added the spark label Jan 17, 2026
@97harsh
Copy link
Contributor Author

97harsh commented Jan 17, 2026

@pvary Can you help review this?

@pvary
Copy link
Contributor

pvary commented Jan 17, 2026

Are these clean backports, or did you have to do any manual changes?

String explicitBranch = input.asString(BRANCH_PARAM, null);

// Load SparkTable to extract branch from identifier
SparkTable sparkTable = loadSparkTable(tableIdent);
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

3 participants