Repository navigation
Return null operation for snapshots without a summary - #4477
Open
rahulsmahadev wants to merge 2 commits into
Open
rahulsmahadev wants to merge 2 commits into
rahulsmahadev wants to merge 2 commits into
Conversation
A format v1 snapshot can have no summary, so it has no operation. inspect.snapshots() stored str(operation), which put the text "None" in the nullable operation column. Store the operation as is, so the cell is null, as Java's SnapshotsTable does. Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:snapshots()setsoperation = Nonein this case, then storesstr(operation)in the nullable column.Fix: store
operationas is, so a missing summary gives a null cell.summaryis already null.Java: Spark's
.snapshotsscan usesSnapshotsTable, which returns the operation parsed bySnapshotParserunchanged, including null (TestSnapshotJsonchecks the null). This PR fixes the equivalent PyIceberg inspection output.Still different from Java, not changed here:
"summary": {}reads as operationoverwrite(with a warning, as inSummary), while Java reads it as no summary.Are these changes tested?
Yes.
test_inspect_snapshots_operation_is_null_without_summaryintests/table/test_inspect.pybuilds a v1 table, removes the summary from its snapshot in the metadata file, and checks thatoperationis null. It fails on main with['None']where[None]is expected, and passes with this change. The v2 control still reportsappend.Are there any user-facing changes?
Yes,
operationis null instead of the stringNonefor snapshots without a summary. Please add thechangeloglabel.This pull request and its description were written by Isaac.