Core: Enable picking of old partition spec data files using a flag for rewrite#16190
Open
mukund-thakur wants to merge 1 commit intoapache:mainfrom
Open
Core: Enable picking of old partition spec data files using a flag for rewrite#16190mukund-thakur wants to merge 1 commit intoapache:mainfrom
mukund-thakur wants to merge 1 commit intoapache:mainfrom
Conversation
nastra
reviewed
May 4, 2026
| * | ||
| * <p>Defaults to false. | ||
| */ | ||
| public static final String REWRITE_PARTITION_SPEC_MISMATCH = "rewrite-partition-spec-mismatch"; |
Contributor
There was a problem hiding this comment.
I don't think this justifies adding another flag. You should be able to use existing flags to achieve this
Contributor
Author
There was a problem hiding this comment.
Thanks for looking @nastra !
I went though the code but couldn't find any flag to achieve this.
We can use filters to filter old data based on some column values for example timestamp for rewriting first time but that won't work if there are so many files and jobs fail half way. When we rerun, it will again pick up the same files even if we have rewritten 50% of files successfully. Currently, we can't filter data files based on the spec ID.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16189
Explored solution using existing code and feature flags:
As our use case is to rewrite the old partition spec data files to new spec data files, we have to use rewrite-all=true as rewrite job will skip the files which are already of desired size for example (512 MB by default) or if only one file per group rewrite but we would still need to rewrite them to desired spec.
Based on a suggestion by @pvary on an old PR #here and looking at the current code, I thought we can use filters to filter only the old data files after applying rewrite-all=true based on some column values for example timestamp( month <=2025-06) for rewriting. To efficiently rewrite a huge number of data files we have to also use partial-progress.enabled and partial-progress.max-commits such that if job fails half way we don't need to start from scratch.
Why this won't work?
Suppose there are so many files to rewrite and jobs fail half way. When we rerun using the same filter, it will again pick up the same files even if we have rewritten suppose 50% of files successfully. We can somehow improve the filter to pick only old files after every iteration but it puts a lot of work on end-user as currently we can't filter data files based on the spec ID. That is why I suggest to enable this use case using this new flag ewrite-partition-spec-mismatch and partial-progress.enabled.