ebyhr commented on code in PR #4477:
URL: https://github.com/apache/iceberg-python/pull/4477#discussion_r4688464239
##########
tests/table/test_inspect.py:
##########
@@ -104,6 +104,32 @@ def
test_inspect_entries_and_files_with_data_file_without_metrics(catalog: InMem
assert files[0]["column_sizes"] is None
+def test_inspect_snapshots_operation_is_null_without_summary(catalog:
InMemoryCatalog) -> None:
Review Comment:
The test can be much shorter. It doesn't need the metadata file rewrite, or
the `file://` handling. Replacing the summary on the in-memory metadata
exercises the same code path:
```python
def test_inspect_snapshots_operation_is_null_without_summary(catalog:
InMemoryCatalog) -> None:
schema = Schema(NestedField(1, "x", LongType(), required=False))
tbl = catalog.create_table("default.snapshot_without_summary", schema)
tbl.append(pa.table({"x": [1]}, schema=pa.schema([pa.field("x",
pa.int64())])))
# The summary is optional in v1, so a snapshot without one has no
operation
snapshot = tbl.metadata.snapshots[0].model_copy(update={"summary": None})
tbl.metadata = tbl.metadata.model_copy(update={"snapshots": [snapshot]})
snapshots = tbl.inspect.snapshots()
assert snapshots.column("operation").to_pylist() == [None]
assert snapshots.column("summary").to_pylist() == [None]
```
##########
pyiceberg/table/inspect.py:
##########
@@ -138,7 +138,7 @@ def snapshots(self) -> pa.Table:
"committed_at":
datetime.fromtimestamp(snapshot.timestamp_ms / 1000.0, tz=UTC),
"snapshot_id": snapshot.snapshot_id,
"parent_id": snapshot.parent_snapshot_id,
- "operation": str(operation),
+ "operation": operation,
Review Comment:
The fix looks right and matches Java's `SnapshotsTable`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]