Skip to content

[python] Reuse Parquet fragment metadata for single-file reads - #9881

Open
XiaoHongbo-Hope wants to merge 1 commit into
apache:masterfrom
XiaoHongbo-Hope:codex/atomic-s3-snapshot-commit
Open

XiaoHongbo-Hope wants to merge 1 commit into
apache:masterfrom
XiaoHongbo-Hope:codex/atomic-s3-snapshot-commit

Conversation

@XiaoHongbo-Hope

@XiaoHongbo-Hope XiaoHongbo-Hope commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Purpose

Reading a known Parquet data file through ds.dataset(path, ...) performs path discovery and loads metadata into separate objects. With the default metadata cache enabled, a local cold scan makes one get_file_info call and three open_input_file calls.

Create a ParquetFileFragment directly and build FileSystemDataset with that same fragment and its physical schema. This reduces the local cold scan to zero probes and two opens, while retaining the existing cache lifecycle, physical schema handling, and constructor for other formats.

Tests

  • Added call-count regressions for cold/hot reads, disabled cache, eviction and concurrent scans. Verify that schema, footer metadata, row-group splitting and cache-size estimation reuse loaded fragment metadata without more I/O. Added missing/corrupt-file failure and retry coverage.
  • 150 tests passed on Python 3.11 / PyArrow 19.0.1 after applying the change to current master: metadata cache, row ranges, VARIANT row groups, schema evolution, nested fields, predicate pushdown and row readers/writers.
  • Repository-configured flake8, license-header checks and git diff --check passed. PyArrow 16.1.0 was unavailable and remains unverified.

Also ran a real DLF → Jindo 6.10.401 → OSS A/B with this loader change isolated. Used fixed snapshots and identical queries, files and read parallelism (4), with A-B-B-A process ordering and a cold/hot read in each process. All output hashes matched across 32 Parquet scans. Native successful-response logs accounted for 448 unique OSS request IDs.

Data-file requests per query HEAD before → after GET before → after
Four files, complete cold scan 12 → 8 12 → 8
Four files, complete warm scan 4 → 4 4 → 4
Cold scan with filter and nested projection 11 → 7 11 → 7
Metadata cache disabled, each scan 8 → 8 8 → 8

The complete-scan results held for both 1,024-row small-file and 16,384-row larger-file fixtures (each larger file exceeds 64 KiB). Counts cover data-file requests, excluding DLF metadata and manifest planning. They are specific to these fixtures and SDK settings; they do not establish a production QPS reduction. Temporary test tables were cleaned up.

@XiaoHongbo-Hope
XiaoHongbo-Hope force-pushed the codex/atomic-s3-snapshot-commit branch from 9e74410 to 826f7b7 Compare September 16, 2026 09:20
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Prevent concurrent S3 metadata overwrites [python] Prevent concurrent S3/OSS metadata overwrites Sep 16, 2026
@XiaoHongbo-Hope
XiaoHongbo-Hope force-pushed the codex/atomic-s3-snapshot-commit branch from 826f7b7 to 21dca66 Compare September 16, 2026 11:58
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Prevent concurrent S3/OSS metadata overwrites [python] Prevent concurrent S3 metadata overwrites Sep 16, 2026
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Prevent concurrent S3 metadata overwrites [python] Use conditional S3 puts for atomic metadata writes Sep 16, 2026
@XiaoHongbo-Hope
XiaoHongbo-Hope force-pushed the codex/atomic-s3-snapshot-commit branch from 21dca66 to d970dae Compare September 18, 2026 04:02
@XiaoHongbo-Hope XiaoHongbo-Hope changed the title [python] Use conditional S3 puts for atomic metadata writes [python] Reuse Parquet fragment metadata for single-file reads Sep 18, 2026
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review September 18, 2026 04:02
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as draft September 18, 2026 04:04
@XiaoHongbo-Hope
XiaoHongbo-Hope marked this pull request as ready for review September 18, 2026 08:03
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