Skip to content

fix: [branch-1.2] key the Parquet metadata cache by object store (#7856) - #7867

Draft
sshpuntoff wants to merge 2 commits into
apache:branch-1.2from
Qualytics:backport-1.2-metadata-cache-by-store
Draft

sshpuntoff wants to merge 2 commits into
apache:branch-1.2from
Qualytics:backport-1.2-metadata-cache-by-store

Conversation

@sshpuntoff

Copy link
Copy Markdown

Which issue does this PR close?

Backport of #7856 to branch-1.2. Part of #7855.

Rationale for this change

branch-1.2 has the bug of #7855: two scans in one native plan share a cached Parquet footer when their files have the same path and size in different object stores, and the second scan silently drops rows.

What changes are included in this PR?

The two commits of #7856, cherry-picked with -x. #7856 has not merged yet, so I will pick its squash commit again once it does, and this stays a draft until then.

Adaptations:

  • native/core/src/parquet/mod.rs and native/core/src/parquet/parquet_exec.rs: the cherry-pick conflicted on a neighbouring line for file_error_context, which branch-1.2 does not have. I kept only the metadata_cache lines.

Other release branches: branch-1.2 is the newest, so no newer branch needs the fix. branch-1.1 and branch-1.0 also key the shared cache by path. They have no Delta scan and the cherry-pick needs more adaptation there, so I have not opened backports for them. I can if the maintainers want those lines covered.

How are these changes tested?

  • cargo check --all-targets and cargo clippy --all-targets -- -D warnings in native/ pass.
  • cargo test -p datafusion-comet --lib passes, including the three tests the fix added.
  • With the store removed from the key, same_path_and_size_in_two_stores_do_not_share_cached_metadata and same_path_and_size_in_two_abfs_containers_do_not_share_cached_metadata fail on this branch, which shows the branch has the bug.
  • ./mvnw test-compile was not run. The change is Rust only.

🤖 Generated with Claude Code

sshpuntoff and others added 2 commits December 4, 2026 15:46
One runtime serves every scan of a native plan, and its Parquet metadata
cache is keyed by a file's path within its store. An entry is valid while
the file's size and modification time are unchanged, and every file a scan
lists carries the same modification time. Two scans of one plan that read
files of the same path and size from different stores therefore shared an
entry: the second file was read with the first one's footer, whose
statistics could prune its rows.

Read and write the cache through a view that puts the store's URL in the
key. The scan and the deletion-vector prefetch of a Delta scan use the
same view, so the prefetch still serves the scan.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 27ace25)
…ntainers

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit c32a696)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant