Summary
PyIceberg uses PyArrow as its sole execution engine. PyArrow is a kernel library with no memory management, no spill-to-disk, and no join operators. Operations that process more data than available memory (CoW deletes, equality delete resolution, scan planning for heavily-deleted tables, sorted writes) crash with OOM errors.
This issue tracks introducing a pluggable backend interface (ReadBackend, WriteBackend, ComputeBackend protocols) and integrating Apache DataFusion as the first bounded-memory compute backend.
Problem
| Operation | Current Status | OOM Pattern |
|---|
| Equality delete reads | Hard ValueError | Anti-join requires all delete keys in memory |
| CoW delete (large files) | OOMs | Materializes entire Parquet file into RAM |
| Scan planning (>100K deletes) | OOMs | All delete entries in Python dict |
| Sort-on-write | Not implemented | Full sort before write |
| Positional deletes (millions) | OOMs | Python set of positions |
Tables written by Flink (which uses equality deletes) are completely unreadable by PyIceberg today.
Solution
- Pluggable interface:
ReadBackend, WriteBackend, ComputeBackend protocols that decouple PyIceberg from PyArrow - DataFusion integration: Bounded-memory sort, join, and filter with spill-to-disk via
datafusion-python - Migration: All existing data operations route through the interface with zero API changes
Deliverables
Related Issues
Acceptance Criteria
- All existing tests pass without
datafusion installed (no regression) - Tables with equality deletes return correct results
- CoW delete on 2GB+ files completes without OOM (with DataFusion)
- Sort-on-write produces sorted files when table has sort order and DataFusion installed
- Property-based tests verify PyArrow and DataFusion backends produce identical output
Summary
PyIceberg uses PyArrow as its sole execution engine. PyArrow is a kernel library with no memory management, no spill-to-disk, and no join operators. Operations that process more data than available memory (CoW deletes, equality delete resolution, scan planning for heavily-deleted tables, sorted writes) crash with OOM errors.
This issue tracks introducing a pluggable backend interface (
ReadBackend,WriteBackend,ComputeBackendprotocols) and integrating Apache DataFusion as the first bounded-memory compute backend.Problem
ValueErrorTables written by Flink (which uses equality deletes) are completely unreadable by PyIceberg today.
Solution
ReadBackend,WriteBackend,ComputeBackendprotocols that decouple PyIceberg from PyArrowdatafusion-pythonDeliverables
Related Issues
Acceptance Criteria
datafusioninstalled (no regression)