Repository navigation
Conversation
The spec requires the rows of a position delete file to be sorted by `file_path` and then `pos`, so that a reader can filter rows while scanning instead of loading the whole delete file. The delete rows of one mutation come from many data files and the mutation pipeline emits them interleaved, so they were written in pipeline order: a `DELETE` over a table with 50 data files produced a delete file whose rows jump between data files. Sort the delete stream inside the mutation pipeline. A single sort over the whole stream is enough for the per-file requirement: the delete files are split by partition key afterwards, and a subsequence of a sorted sequence stays sorted. Doing it in the pipeline rather than buffering the pairs and sorting before the write keeps the memory bounded - `MergeSortingTransform` spills to disk under the same settings as an ordinary `ORDER BY`, while the delete path itself still streams block by block. The pipeline is resized to one stream first, because merging the sorted streams with a plain resize would interleave them again. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [c75568b] Summary: ❌
AI ReviewSummaryThis PR makes Iceberg mutations write position delete rows in spec order by sorting them on Findings
Final VerdictChanges requested: preserve parallel sorting here, or show why forcing the delete path through one sort stream is acceptable for large multi-file Iceberg mutations. |
| delete_sort_description.emplace_back(block_row_number); | ||
|
|
||
| auto builder = interpreter->execute(); | ||
| builder.resize(1); |
There was a problem hiding this comment.
This resize(1) makes the whole position-delete sort single-stream. After it, fullSortStreams builds exactly one PartialSortingTransform / MergeSortingTransform, so a DELETE or UPDATE over many Iceberg data files loses the read parallelism we already had and funnels every deleted row through one sorter.
SortingStep already has the full-sort path that keeps per-stream sorting parallel and only adds a final merge, which seems like a much better fit here. Can we use that instead of collapsing the pipeline up front?
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Sort the rows of an Iceberg position delete file by file_path and pos
Workflow [PR]
Sync PR [sync-upstream/pr/120916]