INSERT nullability: unpartitioned path skips the runtime NULL check; partitioned path rejects nullable sources at plan time

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

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

まだ誰も着手していません。

評価

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

調査の方向性

Start in crates/datafusion/src/table/mod.rs at project_with_partition and crates/datafusion/src/physical_plan/write.rs at execute_input_stream; compare the unpartitioned and partitioned paths with DataFusion's check_not_null_constraints. Reproduce the MemTable INSERT with a nullable id, then verify both paths use the table schema, catch actual NULLs at runtime, and allow nullable sources when no NULL is present.

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

説明

Reported by @mbutrovich in #19.

Unpartitioned tables: NULLs are written into required columns

The unpartitioned path skips project_with_partition (table/mod.rs), and IcebergWriteExec passes the input's own schema as the sink schema to execute_input_stream (write.rs).

DataFusion only runs check_not_null_constraints for columns that are non-nullable in the sink schema and nullable in the input. Because both schemas are the input's here, the check never runs.

Repro: inserting SELECT * FROM source into an unpartitioned table with a required id: int column, from a MemTable whose nullable id holds [1, NULL], succeeds and reads back 0, 1. The NULL is written as 0.

Partitioned tables: nullable sources are rejected at plan time

The partitioned path goes the other way. project_with_partition rejects any source column that is nullable where the table column is required, even when the source holds no nulls. DataFusion's own sinks accept that case and check at runtime.

Possible fix

Passing the table's Arrow schema (plus the partition column) as the sink schema to execute_input_stream would likely fix both: nulls would be caught at runtime on either path, and the plan-time rejection of nullable sources could be relaxed.

主要言語
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 を短くまとめたダイジェスト。