apache / apache/iceberg-python

Honor identity sort orders for Arrow table writes

Offen
#3,848 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
1.1k
Forks
581
Ø Merge
1 T. 17 Std.
Gemergte PRs (30 T.)
78

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Überprüfe zuerst PR #3830 zusammen mit der Unit- und Integrationsabdeckung, die es für Arrow table writes hinzufügt. Prüfe, wie sort-order IDs, WriteTask, DataFile, manifests und bin packing behandelt werden. Erledigt ist die Aufgabe, wenn unterstützte identity-sort writes geordnete Dateien mit wahrheitsgemäßen sort_order_id-Werten erzeugen, während nicht unterstützte Fälle das aktuelle Verhalten und die Warnung beibehalten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
databases
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.