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() を合わせて調べてください。参照が1つの場合と複数の場合の回帰テストを追加し、関連する出力テストを実行してください。各参照が、すべての保持プロパティを含む1つの 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時間
- マージ済み PR(30日)
- 45
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 が 6 日前に担当しました。 オープン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 件 ·
メンテナーはふだん 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
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
onyx-dot-app/onyx#16016 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
black --check exits 0 and prints All done when a multi file run is interrupted対応中かも @jiteshgulati が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信
-
Non-positive worker counts wait for results without starting workers対応中かも @IlyaKhalafi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信