`inspect.files()` and the other file metadata tables raise `ArrowInvalid` when a snapshot has no manifests
维护者通常 1 天内回复
评估
调研方向
从 pyiceberg/table/inspect.py 开始:_files 以 pa.concat_tables(results) 结尾,_all_files 也是如此,因此当清单列表为空时两者都会失败。运行复现脚本,它会向 SqlCatalog 表追加一个空的 Arrow 表,然后调用 inspect.files()。当 files()、data_files()、delete_files() 以及 all_* 系列变体返回带有 files 架构的空表,而不是抛出 ArrowInvalid 时即完成,包括在用空表执行 overwrite 之后。
由索引模型根据 Issue 内容生成。
描述
Apache Iceberg version
0.12.0 (latest release)
Please describe the bug 🐞
Appending an empty Arrow table creates a snapshot whose manifest list has no manifests. After that, inspect.files(), data_files(), delete_files(), all_files(), all_data_files(), and all_delete_files() all raise ArrowInvalid: Must pass at least one table. I expected each of them to return an empty table with the files schema.
import tempfile
import pyarrow as pa
from pyiceberg.catalog.sql import SqlCatalog
warehouse = tempfile.mkdtemp()
catalog = SqlCatalog("t", uri=f"sqlite:///{warehouse}/catalog.db", warehouse=f"file://{warehouse}")
catalog.create_namespace("n")
df = pa.table({"x": pa.array([], pa.int64())})
table = catalog.create_table("n.t", schema=df.schema)
table.append(df)
table.inspect.files() # ArrowInvalid: Must pass at least one table
Traceback (most recent call last):
File "repro.py", line 12, in <module>
table.inspect.files() # ArrowInvalid: Must pass at least one table
^^^^^^^^^^^^^^^^^^^^^
File "pyiceberg/table/inspect.py", line 900, in files
return self._files(snapshot_id)
^^^^^^^^^^^^^^^^^^^^^^^^
File "pyiceberg/table/inspect.py", line 888, in _files
return pa.concat_tables(results)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "pyarrow/table.pxi", line 6344, in pyarrow.lib.concat_tables
File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Must pass at least one table
overwrite() with an empty table after a non-empty append also leaves a snapshot with no manifests, and files() fails the same way.
_files reads one table per manifest and ends with pa.concat_tables(results), so an empty manifest list calls pa.concat_tables([]). _all_files does the same at L981. Both already return an empty table one level up: _files when the table has no current snapshot (L876-L877), and _all_files when the table has no snapshots (L968-L970). Could they return the same empty table when there are no manifests?
This reproduces on 0.12.0 and on main at e3564a54c10960307147377c578680276865ed18.
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 小时
- 30 天内合并 PR
- 122
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/iceberg-python 的其他 Issue
-
`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 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
apache/iceberg-python#4010 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 apache/iceberg-python 的全部 Issue
相似的 Issue
-
Unknown stop ID in slow zone data crashes post formatting and skips the rest of that day's posts未关闭backend bug tm-new-volunteer
难度 2/5 1-3 小时 新手友好度 84/100
transitmatters/mbta-slow-zone-bot#81 · 1 条评论 ·
-
area:schema documentation
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
risk:high type:ci
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
spacetelescope/rdmt-spire#49 ·
维护者通常 1 天内回复