CaptainAni187 opened a new issue, #3753: URL: https://github.com/apache/iceberg-rust/issues/3753
### Apache Iceberg Rust version main (0.10.1) ### Describe the bug `RecordBatchPartitionSplitter::split` groups rows in a `HashMap`, so the `(PartitionKey, RecordBatch)` pieces come back in hash order, not in the order the partition values appear in the batch. That breaks `ClusteredWriter` when its input is already sorted by partition. If a partition spans two batches, the splitter can hand back a later partition first, which closes the earlier one, and then the next batch tries to write to it again and fails with "Cannot write to partition that was previously closed". Came across this through apache/datafusion-iceberg#39.... its fanout-disabled path feeds `split` straight into `ClusteredWriter`. There's a stopgap in apache/datafusion-iceberg#81 that sorts the pieces there, but it fits better in the splitter itself. ### To Reproduce Identity partition on an int column, sorted input written through `ClusteredWriter` in two batches: - batch 1: `[1, 1, 2, 2]` - batch 2: `[2, 3]` When `split` returns batch 1 as `(2), (1)`, writing `1` closes partition `2`, and batch 2's `2` then fails. Which order you get changes from run to run. ### Expected behavior `split` returns the pieces in the order each partition value first appears in the batch, so sorted input stays sorted for the clustered writer. ### Willingness to contribute I can contribute a fix for this bug independently -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
