apache / apache/iceberg-python

Honor identity sort orders for Arrow table writes

Đang mở
#3,848 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
1.1k
Fork
581
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
78

Mô tả

## 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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Trước tiên, hãy xem xét PR #3830, cùng với phần coverage unit và integration mà PR này bổ sung cho việc ghi bảng Arrow. Kiểm tra cách sort-order IDs, WriteTask, DataFile, manifests và bin packing được xử lý. Được coi là hoàn tất khi các identity-sort writes được hỗ trợ tạo ra các tệp có thứ tự với các giá trị sort_order_id chính xác, trong khi các trường hợp không được hỗ trợ vẫn giữ nguyên hành vi và cảnh báo hiện tại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
databases
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.