rahulsmahadev opened a new pull request, #4477:
URL: https://github.com/apache/iceberg-python/pull/4477
# Rationale for this change
Bug: a snapshot can have no `summary`, and then it has no operation. The
summary is optional in v1, and a v1 table upgraded to v2 keeps such snapshots.
`Table.inspect.snapshots()` then shows the text `"None"` as the operation:
```python
# tbl is a format v1 table whose snapshot has no summary
tbl.inspect.snapshots().column("operation").to_pylist()
# ['None'], expected [None]
```
`snapshots()` sets `operation = None` in this case, then stores
`str(operation)` in the nullable column.
Fix: store `operation` as is, so a missing summary gives a null cell.
`summary` is already null.
Java: Spark's `.snapshots` scan uses `SnapshotsTable`, which returns the
operation parsed by `SnapshotParser` unchanged, including null
(`TestSnapshotJson` checks the null). This PR fixes the equivalent PyIceberg
inspection output.
Still different from Java, not changed here: `"summary": {}` reads as
operation `overwrite` (with a warning, as in `Summary`), while Java reads it as
no summary.
## Are these changes tested?
Yes. `test_inspect_snapshots_operation_is_null_without_summary` in
`tests/table/test_inspect.py` builds a v1 table, removes the summary from its
snapshot in the metadata file, and checks that `operation` is null. It fails on
main with `['None']` where `[None]` is expected, and passes with this change.
The v2 control still reports `append`.
## Are there any user-facing changes?
Yes, `operation` is null instead of the string `None` for snapshots without
a summary. Please add the `changelog` label.
This pull request and its description were written by Isaac.
--
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]