apache / apache/iceberg-python
Honor identity sort orders for Arrow table writes
- 主要语言
- Python
- 星标
- 1.1k
- 派生
- 581
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 78
描述
## Feature Request / Improvement
PyIceberg accepts table sort orders at write time but ignores them. Arrow table writes produce unsorted data files and hard-code `sort_order_id=None`, so manifests are inconsistent with the sort order the user declared.
Related umbrella issue: #271
### Use case / motivation
Without a truthful sort_order_id and physically ordered data files, readers can't use sort-order-aware pruning and the manifest disagrees with the table's sort metadata. Users who declare a sort order expect their writes to honor it.
### Proposed change
When every sort field uses an identity transform and null placement is consistent, sort materialized Arrow table writes. Unpartitioned tables are sorted before bin packing and each final partition is sorted independently. The table's sort-order ID is recorded on the data files.
Unsupported transforms, nested or missing fields, mixed null placement, and streaming RecordBatchReader writes keep the current behavior. Files are marked unsorted and sort_order_id stays null, with a warning explaining why.
### Implementation
PR #3830 sorts the writes, carries the sort-order ID through WriteTask, writes the truthful DataFile.sort_order_id, and includes unit and integration coverage.
### Tooling note
I developed this with assistance from DS v4 Pro and reviewed the changes myself.
### References
- #271
- #3830
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先查看 PR #3830,以及它为 Arrow 表写入添加的单元测试和集成测试覆盖。检查 sort-order IDs、WriteTask、DataFile、manifests 和 bin packing 的处理方式。当受支持的 identity-sort writes 生成具有真实 sort_order_id 值的有序文件,同时不受支持的情况保留当前行为和警告时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- databases
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100