`add_column` changes the values of an existing column for files without field IDs
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 57/100
調査の方向性
Start with _remove_reassigned_names in pyiceberg/table/name_mapping.py and trace how schema updates change name mappings for files without field IDs. Reproduce the report using the supplied add_files, rename, and add_column sequence, then check both scan results and IsNull("b") filtering. Done means the existing column keeps its values and the filter returns the matching rows after adding the reused name.
索引モデルが issue の本文から書いたものです。
説明
Apache Iceberg version
0.12.0 (latest release); the same logic is on main
Please describe the bug 🐞
Adding a column changes what an existing column reads. Files added with add_files have no field IDs and are read through the name mapping. After a rename, the renamed column reads correctly. Adding a column that reuses the old name then moves that name to the new field in the mapping (_remove_reassigned_names in pyiceberg/table/name_mapping.py). From then on, the renamed column reads as null for those files, and the new column gets its values.
The manifest statistics of those files still describe the original field, so planning also prunes with statistics that no longer match what is read: below, IsNull("b") skips the file although both rows read b as null.
import tempfile
import pyarrow as pa
import pyarrow.parquet as pq
from pyiceberg.catalog.sql import SqlCatalog
from pyiceberg.expressions import IsNull
from pyiceberg.schema import Schema
from pyiceberg.types import LongType, NestedField
d = tempfile.mkdtemp()
catalog = SqlCatalog("c", uri=f"sqlite:///{d}/c.db", warehouse=f"file://{d}")
catalog.create_namespace("ns")
table = catalog.create_table("ns.t", Schema(NestedField(1, "a", LongType())))
# a Parquet file without field IDs, read through the name mapping
pq.write_table(pa.table({"a": [1, 3]}), f"{d}/imported.parquet")
table.add_files([f"file://{d}/imported.parquet"])
with table.update_schema() as update:
update.rename_column("a", "b")
print(table.scan().to_arrow().to_pydict())
# {'b': [1, 3]}
with table.update_schema() as update:
update.add_column("a", LongType())
print(table.scan().to_arrow().to_pydict())
# {'b': [None, None], 'a': [1, 3]}: expected {'b': [1, 3], 'a': [None, None]}
print(table.scan(row_filter=IsNull("b")).to_arrow().num_rows)
# 0: the file is pruned by the statistics of `b`, which hold its original values
Expected: adding a column leaves the values of existing columns unchanged, as it does for files with field IDs. The name was written for the original field in those files, so either the mapping keeps it there, or adding a column whose name files without field IDs still use is refused.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- 主要言語
- Python
- スター
- 1.2k
- フォーク
- 654
- 平均マージ
- 2日 11時間
- マージ済み PR(30日)
- 122
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/iceberg-python のほかの issue
-
`inspect.files()` and the other file metadata tables raise `ArrowInvalid` when a snapshot has no manifests対応中かも @YuangGao が 10 日前に担当しました。 オープンkind:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/iceberg-python#4269 ·
メンテナーはふだん 1 日以内に返信
-
`inspect.entries()` raises TypeError when a data file has no column_sizes対応中かも @Rahul-cs50 が 14 日前に担当しました。 オープンkind:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/iceberg-python#4186 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
`older_than` reads a naive datetime as UTC and expires snapshots it should keep対応中かも @Rahul-cs50 が 13 日前に担当しました。 オープンkind:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/iceberg-python#4182 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
REST: Send empty first-page pageToken when rest-page-size is set対応中かも @ehddnr301 が 32 日前に担当しました。 オープンkind:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/iceberg-python#4096 ·
メンテナーはふだん 1 日以内に返信
-
PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_open対応中かも @David-Banquet が 29 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
apache/iceberg-python#4093 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
apache/iceberg-python の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
glossyio/traffic-monitor#312 ·
メンテナーはふだん 1 日以内に返信
-
local devenv exampleオープンdocumentation enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
es-ude/elastic-ai.creator#1046 ·
メンテナーはふだん 3 日以内に返信
-
feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
confident-ai/deepteam#306 ·
メンテナーはふだん 1 日以内に返信
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL ports対応中かも @himanchalkaushale が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OWASP/Nettacker#1884 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信