Clustered (fanout disabled) writes fail on sorted input because batches are split in HashMap order

Đang mở
#39 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@CaptainAni187 đang làm issue này rồi.

Từ ngày 20/10/2026.

  • #81 của @CaptainAni187 — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
database

Hướng nghiên cứu

Start with crates/datafusion/src/task_writer.rs at the linked splitter and ClusteredWriter call sites, then inspect crates/iceberg/src/arrow/record_batch_partition_splitter.rs. Reproduce by executing IcebergTableProvider::insert_into directly with fanout disabled, batch_size 8, target_partitions 1, and 200 rows. Done means sorted partitioned input writes successfully without the previously closed partition error.

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

Mô tả

bug
Describe the bug

With fanout disabled, TaskWriter splits each batch with iceberg-rust's RecordBatchPartitionSplitter::split and hands the pieces to ClusteredWriter (task_writer.rs#L129-L135, task_writer.rs#L217-L237).

The splitter groups rows in a HashMap, so the partitions within a batch come out in arbitrary order. ClusteredWriter closes the current partition when it sees a different one, and rejects any partition it has already closed. Input that is correctly sorted by partition therefore fails whenever a partition spans a batch boundary. For example, batch N holds [A, B] but is emitted as B then A, and batch N+1 starts with B.

To Reproduce

Execute the plan returned by IcebergTableProvider::insert_into directly, so the SortExec is still present (#38 explains why the optimized plan loses it). Use a table partitioned by identity(cat) with fanout disabled, 200 rows with cat = id % 10, batch_size = 8 and target_partitions = 1.

9 of 10 runs fail with:

The input is not sorted! Cannot write to partition that was previously closed
Expected behavior

Input sorted by partition is written successfully.

Additional context

Fixing #38 alone won't make fanout-disabled writes work. The splitter lives in iceberg-rust (crates/iceberg/src/arrow/record_batch_partition_splitter.rs). Either it emits partitions in first-occurrence order, or TaskWriter orders each batch's pieces by row position before passing them to ClusteredWriter.

Ngôn ngữ chính
Rust
Star
30
Fork
30
Merge trung bình
3 ngày 19 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/datafusion-iceberg

Tất cả issue của apache/datafusion-iceberg

Issue tương tự

Thêm issue về Rust

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.