Expose per-file write metadata from DataFrame.write_parquet()
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Ambito
- backend-api-design, data-engineering
Direzione di ricerca
Inizia verificando se apache/datafusion#23656 è stato integrato, quindi leggi il binding Python per DataFrame.write_parquet() e la issue e la pull request collegate del core Rust. La forma dell’API è ancora aperta: la issue suggerisce di restituire i metadati direttamente o tramite un WriteResult. Il lavoro è completo quando i binding espongono i percorsi per file, i conteggi delle righe e le dimensioni in byte; i metadati serializzati sono opzionali.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem or challenge?
DataFrame.write_parquet() currently returns None. After writing, there is no way to retrieve per-file metadata (row counts, byte sizes, column statistics) for the files that were produced. This forces consumers that need file-level statistics — such as Apache Iceberg, Delta Lake, and Apache Hudi — to either:
- Re-read Parquet footers from object storage after writing (extra I/O round-trips)
- Bypass DataFusion's write pipeline entirely and use PyArrow's
ParquetWriterwithmetadata_collector
This is a blocker for building a complete DataFusion-based write backend for table formats that require per-file column statistics in their commit metadata (e.g., Iceberg's DataFile entries need column_sizes, null_counts, lower_bounds, upper_bounds, split_offsets).
Describe the solution you'd like
After apache/datafusion#23472 / apache/datafusion#23656 lands in the Rust core, ParquetSink will expose a file_metadata() method returning per-file path, row count, and byte size. The Python bindings should surface this:
# Option A: write_parquet returns metadata directly
metadata = df.write_parquet("/path/to/output/")
# metadata: list[dict] = [
# {"path": "part-0.parquet", "row_count": 500, "byte_size": 4096},
# {"path": "part-1.parquet", "row_count": 500, "byte_size": 3840},
# ]
# Option B: write_parquet returns a WriteResult object
result = df.write_parquet("/path/to/output/")
result.count # 1000
result.file_metadata # list of per-file metadata dicts
At minimum, each file metadata entry should include:
path(str): Object-store path of the written filerow_count(int): Number of rows in this filebyte_size(int): Sum of compressed row group sizes
Optionally (for full table-format integration):
metadata(bytes | None): Serialized ParquetFileMetaData(Thrift compact), enabling consumers to extract column statistics without re-reading the file
Describe alternatives you've considered
- Return just the count (status quo): Insufficient for table format integration.
- Expose via a separate accessor: e.g.
ctx.last_write_metadata()— awkward API, not composable. - Return raw bytes of the full Parquet footer: Maximally informative but heavier. A structured dict with optional raw bytes is more ergonomic.
Additional context
- Upstream dependency: apache/datafusion#23656 adds
DataSink::file_metadata()to the Rust core. This issue tracks exposing it through the Python bindings. - Motivation: PyIceberg is building a pluggable execution backend with DataFusion for bounded-memory operations. A DataFusion write backend would enable single-pass Copy-on-Write deletes (read → filter → write entirely in Rust with spill-to-disk), but requires per-file metadata to construct Iceberg
DataFilecommit entries. - Related: #1624 (per-session object store config) is the other piece needed for a complete DataFusion write backend in PyIceberg.
- Lingua principale
- Python
- Stelle
- 605
- Fork
- 176
- Merge medio
- 1g 23h
- PR unite (30g)
- 8
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/datafusion-python
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/datafusion-python#1726 ·
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 88/100
apache/datafusion-python#1691 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/datafusion-python#1644 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
apache/datafusion-python#1737 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
apache/datafusion-python#1735 · 1 commento ·
Tutte le issue di apache/datafusion-python
Issue simili
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Apertaarea: ci bug perceived difficulty: 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-connect#1057 ·