Skip to content

fix: ignore filenames when parsing Hive partitions - #27151

Open
Muneer320 wants to merge 1 commit into
apache:mainfrom
Muneer320:fix/partition-filename-components
Open

Muneer320 wants to merge 1 commit into
apache:mainfrom
Muneer320:fix/partition-filename-components

Conversation

@Muneer320

Copy link
Copy Markdown

Which issue does this PR close?

Closes #27134.

Rationale for this change

For a table partitioned by year and month, a file at year=2024/month=02.parquet is incorrectly read as month 02.parquet. The filename supplies a partition value even though the month=.../ directory is missing.

What changes are included in this PR?

Require a following path component for each partition directory, so the final filename cannot supply a partition value. Preserve percent-decoding and the existing handling of incomplete partition paths. A filename containing = is still valid inside a complete partition directory structure.

Extend the existing partial-partition regression and add SQL coverage alongside the related listing-table partition tests. Disabling the listing cache rebuilds session state and changes the default-catalog setting; reset that setting at the end for the runner's configuration check.

What is the testing strategy for this PR?

  • On the initial source base, the unit regression fails before the fix; all 19 then-existing catalog-listing unit tests, 7 doc tests and listing_table_partitions.slt pass afterward.
  • Refreshed onto main at 888879d01c8131038ab8693cde227597ab5a434f, retaining the new Hive NULL partition behavior and SQL coverage. The filename regression checks skipped incomplete paths, returned rows, partition filtering, and a key=value filename in a complete path.
  • On that refreshed base, cargo fmt --all, cargo clippy --all-targets --all-features -- -D warnings, and the repository's extended workspace test command all pass on a GitHub-hosted runner, before committing this exact patch. That run includes all 21 current catalog-listing unit tests and the SQL logic-test harness.

No existing microbenchmark calls this partition helper; this is a correctness fix and makes no performance claim.

Are there any user-facing changes?

Files whose filenames masquerade as missing partition directories are skipped, consistently with other incomplete partition paths. Complete partition paths retain their existing values. There is no public API change.

AI assistance: Codex assisted with the implementation, regression tests and this description. The author has reviewed the current patch. The change follows the repository's existing parser and test patterns.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) catalog Related to the catalog crate labels Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

catalog Related to the catalog crate sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ListingTable reads a file name as a partition value when a partition directory level is missing

1 participant