-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Avoid null pointer exceptions from empty tables without snapshot #26970
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
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdd a null guard for snapshot in loadAllManifestsFromSnapshot to return an empty manifest list when snapshot is null, preventing NullPointerException during optimize_manifests on empty tables. Sequence diagram for manifest loading with null snapshot guardsequenceDiagram
participant "IcebergMetadata"
participant "Table"
participant "Snapshot"
participant "ManifestFile List"
"IcebergMetadata"->>"Snapshot": Check if snapshot is null
alt snapshot is null
"IcebergMetadata"->>"ManifestFile List": Return empty list
else snapshot is not null
"IcebergMetadata"->>"Table": Get FileIO
"IcebergMetadata"->>"Snapshot": allManifests(FileIO)
"Snapshot"-->>"IcebergMetadata": List<ManifestFile>
end
Class diagram for updated loadAllManifestsFromSnapshot null guardclassDiagram
class IcebergMetadata {
+List<ManifestFile> loadAllManifestsFromSnapshot(Table icebergTable, Snapshot snapshot)
}
class Snapshot {
+List<ManifestFile> allManifests(FileIO io)
}
class Table {
+FileIO io()
}
IcebergMetadata --> Snapshot : uses
IcebergMetadata --> Table : uses
Snapshot --> ManifestFile : returns list
Table --> FileIO : returns
%% Highlight: loadAllManifestsFromSnapshot now returns ImmutableList.of() if snapshot is null
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
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.
Thank you for fixing this.
Can we add a test? |
We already have a test for an empty table in |
Description
It is possible for optimize_manifests to fail
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: