[FLINK-38774][table-common] Skip hidden directories when recursively listing partitions - #28913
Open
hulincup wants to merge 1 commit into
Open
[FLINK-38774][table-common] Skip hidden directories when recursively listing partitions#28913hulincup wants to merge 1 commit into
hulincup wants to merge 1 commit into
Conversation
…listing partitions listStatusRecursively descended into every subdirectory returned by fs.listStatus, including hidden ones such as _temporary. A non-hidden child of a hidden dir (e.g. _temporary/job-123) sitting at partition depth was then collected with an empty partition spec, which later surfaces as 'TableException: incomplete partition spec' in the filesystem connector source. Reuse the existing listStatusWithoutHidden helper to filter hidden children at every recursion level (not only at the leaf, where searchPartSpecAndPaths already filtered). Add a null guard consistent with listStatusWithoutHidden's contract (returns null when fs.listStatus returns null), which also removes a latent NPE in the old for-each over a null list. Adds a @tempdir regression test that creates a real partition (date=2019-8-30/country=China) alongside a hidden _temporary/job-123 subtree and asserts only the real partition is returned. This supersedes the abandoned apache#27314. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
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.
What
PartitionPathUtils.listStatusRecursivelydescended into every subdirectory returned byfs.listStatus, including hidden ones such as_temporary. A non-hidden child of a hidden dir (e.g._temporary/job-123) sitting at partition depth was then collected with an empty partition spec, which later surfaces as aTableException: incomplete partition specin the filesystem connector source.Reported in FLINK-38774 (supersedes the older FLINK-31975).
Fix
Reuse the existing
listStatusWithoutHiddenhelper to filter hidden children at every recursion level — not only at the leaf, wheresearchPartSpecAndPathsalready filtered viaisHiddenFile. Add a null guard consistent withlistStatusWithoutHidden's contract (returnsnullwhenfs.listStatusreturnsnull), which also removes a latent NPE in the old for-each over a null list.Test
Adds a
@TempDirregression test that creates a real partition (date=2019-8-30/country=China) alongside a hidden_temporary/job-123subtree and assertssearchPartSpecAndPathsreturns only the real partition. Without the fix the hiddenjob-123leaf leaks in with an empty spec (2 entries); with the fix only the real partition is returned (1 entry).Notes
flink-table/flink-table-commonutility, not literally underflink-connectors/, but the bug manifests via the filesystem connector (taggedConnectors / FileSystem).