Repository navigation
Return null operation for snapshots without a summary #4477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,6 +104,21 @@ 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: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test can be much shorter. It doesn't need the metadata file rewrite, or the 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]
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, much simpler. Switched to your version and kept one line from the old test that checks |
||
| 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())]))) | ||
| assert tbl.inspect.snapshots().column("operation").to_pylist() == ["append"] | ||
|
|
||
| # 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] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("newest_first", [False, True]) | ||
| def test_partitions_last_updated_uses_latest_snapshot_regardless_of_order(newest_first: bool) -> None: | ||
| # Manifest entries are visited in manifest order, which is not chronological, so the | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks right and matches Java's
SnapshotsTable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking against Java.