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

オープン
#39 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@CaptainAni187 がすでに取り組んでいます。

2026年10月20日 から。

  • #81 @CaptainAni187 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
database

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
30
フォーク
30
平均マージ
3日 19時間
マージ済み PR(30日)
15

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/datafusion-iceberg のほかの issue

apache/datafusion-iceberg の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。