CLI: --output=json list-refs emits one object per retention property instead of per ref
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 87/100
Hướng nghiên cứu
Đọc pyiceberg/cli/output.py và kiểm tra JsonOutput.describe_refs() cùng với ConsoleOutput.describe_refs(). Bổ sung kiểm thử hồi quy cho trường hợp một và nhiều tham chiếu, sau đó chạy các kiểm thử output liên quan. Công việc hoàn tất khi mỗi tham chiếu tạo ra một đối tượng JSON chứa tất cả thuộc tính lưu giữ của tham chiếu đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 1.2k
- Fork
- 618
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 45
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
-
REST: Send empty first-page pageToken when rest-page-size is setCó thể đã có người làm @ehddnr301 đã nhận 2 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_openĐ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 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
View does not expose metadata_location: RestCatalog.load_view discards it from the server's responseCó thể đã có người làm @Soumo-git-hub đã nhận 7 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 84/100
apache/iceberg-python#4073 · 1 bình luận ·
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 70/100
apache/iceberg-python#4010 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
to_bytes silently rescales a Decimal with a negative scaleCó thể đã có người làm @Rodrigo-Palma đã nhận 26 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/iceberg-python#3996 ·
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ự
-
Agentic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/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 82/100
Imbad0202/academic-research-skills#979 ·
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
reflex-dev/reflex#7561 · 1 bình luận ·
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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
prometheus-community/ansible#906 · 2 bình luận ·