`add_column` changes the values of an existing column for files without field IDs
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
- 57/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 1.2k
- Fork
- 654
- Merge trung bình
- 2 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 122
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/iceberg-python
-
`inspect.files()` and the other file metadata tables raise `ArrowInvalid` when a snapshot has no manifestsCó thể đã có người làm @YuangGao đã nhận 10 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/iceberg-python#4269 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`inspect.entries()` raises TypeError when a data file has no column_sizesCó thể đã có người làm @Rahul-cs50 đã nhận 14 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/iceberg-python#4186 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`older_than` reads a naive datetime as UTC and expires snapshots it should keepCó thể đã có người làm @Rahul-cs50 đã nhận 13 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
apache/iceberg-python#4182 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
REST: Send empty first-page pageToken when rest-page-size is setCó thể đã có người làm @ehddnr301 đã nhận 32 ngày trước. Đang mởkind:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/iceberg-python#4096 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_openCó thể đã có người làm @David-Banquet đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
apache/iceberg-python#4093 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/iceberg-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
glossyio/traffic-monitor#312 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
local devenv exampleĐang mởdocumentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
es-ude/elastic-ai.creator#1046 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
ENH: permit cachetools >= 7Đang mởfeature request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
confident-ai/deepteam#306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsCó thể đã có người làm @himanchalkaushale đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
OWASP/Nettacker#1884 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày