INSERT fails after a column is added to the table, until the provider is rebuilt
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
Start with insert_into in crates/datafusion/src/table_provider/catalog_table_provider.rs, where the cached Arrow schema is used to plan the input, then read IcebergWriteExec in crates/datafusion/src/write/exec.rs, where the Parquet writer takes the table's current schema. Reproduce by adding a column to the table outside the session and running an INSERT. Done means either the missing columns are filled with NULL, or the INSERT fails with a clear schema-changed error, and a test covers the case. The fix choice is a design decision, so confirm it with maintainers first.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
IcebergCatalogTableProvider caches the table's Arrow schema when it is built (catalog_table_provider.rs#L81-L84). IcebergCatalogProvider builds one provider per table when it is constructed and keeps it (schema.rs#L64-L94). insert_into plans its input against the cached schema, but IcebergWriteExec builds the Parquet writer from the table's current schema (write/exec.rs#L244-L250).
Once a column has been added to the table, by another engine or another session, the input batches lack that column and the Parquet writer fails on it:
Execution error: DataInvalid => Field id 3 not found in struct array
Every INSERT through that provider fails this way, with or without a column list, including after other sessions have written with the new schema. Scans through the same provider keep working and return only the cached columns. Writing works again only once the provider is rebuilt, which for IcebergCatalogProvider means registering the catalog again.
To Reproduce
Tested with an unpartitioned table in a MemoryCatalog:
- Create
ns.t(id INT NOT NULL, name STRING NOT NULL), register anIcebergCatalogProviderascin a session, and runINSERT INTO c.ns.t VALUES (1, 'a'). - Outside that session, add an optional column, for example with
Transaction::update_schema().add_column(AddColumn::optional("email", Type::Primitive(PrimitiveType::String)))orALTER TABLE t ADD COLUMN email STRINGfrom Spark. - In the same session, run
INSERT INTO c.ns.t VALUES (2, 'b')orINSERT INTO c.ns.t (id, name) VALUES (2, 'b'). Both fail with the error above.
In a session that registers the catalog after step 2, INSERT INTO c.ns.t (id, name) VALUES (2, 'b') succeeds and email reads back as NULL.
Expected behavior
The INSERT succeeds and writes NULL for email, as it does through a provider built after the change. At the least, it should fail with an error saying that the table's schema changed after the provider was built.
Additional context
- This is a concrete case of #24 §2: the provider plans with its cached schema but writes with the table's current metadata. It persists because of #24 §1:
IcebergCatalogProvidernever rebuilds its providers. - #48 adds a constructor so that Ballista can rebuild a provider on the scheduler with the schema the client planned against. Ballista runs DML through that rebuilt provider, so it fails the same way.
- Possible fixes:
- have
IcebergWriteExecfill the columns the input lacks with NULL, or with their write default - have
insert_intocompare the cached schema with the table's current schema and return a clear error
- have
- 主要言語
- Rust
- スター
- 33
- フォーク
- 34
- 平均マージ
- 4日 14時間
- マージ済み PR(30日)
- 10
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/datafusion-iceberg のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/datafusion-iceberg#100 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
apache/datafusion-iceberg#101 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
apache/datafusion-iceberg#85 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/datafusion-iceberg#84 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
apache/datafusion-iceberg#75 ·
メンテナーはふだん 1 日以内に返信
apache/datafusion-iceberg の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
quarto-dev/q2#1155 ·
メンテナーはふだん 1 日以内に返信
-
backlog priority: low ui
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
storytold/vectorcraft#6445 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area: cli kind:docs priority: P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tursodatabase/libsql#2312 ·
メンテナーはふだん 11 日以内に返信
-
`NodeOwned::size_in_bytes` does not count the `ChildrenNodesOwned` heap allocation (since #216)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
paritytech/trie#251 ·
メンテナーはふだん 1 日以内に返信