Spark: Fix orphan file matching for sibling table prefixes - #17448
Open
alessandro-nori wants to merge 2 commits into
Open
Spark: Fix orphan file matching for sibling table prefixes#17448alessandro-nori wants to merge 2 commits into
alessandro-nori wants to merge 2 commits into
Conversation
alessandro-nori
marked this pull request as ready for review
July 31, 2026 12:13
uros-b
reviewed
Jul 31, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
@alessandro-nori Please note that this may have already been in progress: #16498.
Member
|
cc @wombatu-kun ^^ |
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.
Summary
DeleteOrphanFilesSparkAction.filteredCompareToFileList(), whencompareToFileListis used, files are filtered withstartsWith(location). Iflocationdoesn't end with/, this can also match sibling table paths (e.g./ns/my_tablematches/ns/my_table_2), incorrectly marking their files as orphans of the wrong table.locationto always end with/before filtering, mirroring the behavior of the default directory-listing path.Motivation
Prevents
deleteOrphanFileswith a customcompareToFileListfrom deleting files belonging to a different table that merely shares a path prefix with the target table's location.See #17449 for a repro-only PR (test without the fix) demonstrating the bug — CI fails there as expected.