CLI: --output=json list-refs emits one object per retention property instead of per ref
维护者通常 1 天内回复
评估
调研方向
阅读 pyiceberg/cli/output.py,并检查 JsonOutput.describe_refs() 和 ConsoleOutput.describe_refs()。为一个和多个引用的情况添加回归测试,然后运行相关的输出测试。每个引用都生成一个包含其所有保留属性的 JSON 对象,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Apache Iceberg version
None
Please describe the bug 🐞
Apache Iceberg version
main (development)
Please describe the bug
JsonOutput.describe_refs() emits one JSON object for each retention property rather than one object per snapshot reference.
As a result, pyiceberg --output=json list-refs <table> can return three objects for a table containing only one snapshot reference.
Reproduction
from pyiceberg.cli.output import JsonOutput
from pyiceberg.table.refs import SnapshotRefType
JsonOutput().describe_refs([
(
"main",
SnapshotRefType.BRANCH,
{
"min_snapshots_to_keep": "1",
"max_snapshot_age_ms": "432000000",
"max_ref_age_ms": "forever",
},
)
])
Actual output
[
{"name": "main", "type": "branch", "min_snapshots_to_keep": "1"},
{"name": "main", "type": "branch", "max_snapshot_age_ms": "432000000"},
{"name": "main", "type": "branch", "max_ref_age_ms": "forever"}
]
Expected output
[
{
"name": "main",
"type": "branch",
"min_snapshots_to_keep": "1",
"max_snapshot_age_ms": "432000000",
"max_ref_age_ms": "forever"
}
]
Root cause
In pyiceberg/cli/output.py, JsonOutput.describe_refs() uses a nested list comprehension:
[
{"name": name, "type": type, detail_key: detail_val}
for name, type, detail in refs
for detail_key, detail_val in detail.items()
]
The inner loop creates a separate object for every entry in detail.
This is inconsistent with ConsoleOutput.describe_refs(), which renders one row per reference.
Suggested fix
Construct one dictionary per reference and merge the retention properties into it. Add a regression test ensuring that one input reference produces one complete JSON object, ideally also covering multiple references.
I reproduced the incorrect output by executing the current list-comprehension logic in isolation. I have not yet run the full CLI against a catalog.
Willingness to contribute
I'd be happy to submit a focused fix with regression tests if the proposed JSON structure is correct.
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
- 派生
- 618
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 45
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/iceberg-python 的其他 Issue
-
REST: Send empty first-page pageToken when rest-page-size is set可能已有人在做 @ehddnr301 于 2 天前认领。 未关闭kind:bug
难度 2/5 1-3 小时 新手友好度 82/100
apache/iceberg-python#4096 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
apache/iceberg-python#4093 · 1 条评论 ·
维护者通常 1 天内回复
-
View does not expose metadata_location: RestCatalog.load_view discards it from the server's response可能已有人在做 @Soumo-git-hub 于 7 天前认领。 未关闭kind:bug
难度 2/5 1-3 小时 新手友好度 84/100
apache/iceberg-python#4073 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
apache/iceberg-python#4010 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
to_bytes silently rescales a Decimal with a negative scale可能已有人在做 @Rodrigo-Palma 于 26 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apache/iceberg-python#3996 ·
维护者通常 1 天内回复
查看 apache/iceberg-python 的全部 Issue
相似的 Issue
-
Agentic
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
Imbad0202/academic-research-skills#979 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
reflex-dev/reflex#7561 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 62/100
prometheus-community/ansible#906 · 2 条评论 ·