Repository navigation
Conversation
ebyhr
reviewed
Nov 20, 2026
| @Override | ||
| public long getLength() { | ||
| if (blobSize == null) { | ||
| this.blobSize = getBlob().getSize(); |
Member
There was a problem hiding this comment.
GCSInputStream has the same unchecked storage.get(blobId).getSize(). Worth a follow-up?
Author
There was a problem hiding this comment.
yeah GCSInputStream has the same problem, I'll open a follow-up PR for it after this one.
There was a problem hiding this comment.
Thanks for working on this.
Wondering, that fix in GCSInputStream looks exactly the same, can it be fixed in the PR instead?
Author
There was a problem hiding this comment.
Hi @linzch3, yes it will be good to have both of them in one place.
Author
| } | ||
|
|
||
| @Test | ||
| public void getLengthMissingBlob() { |
Member
There was a problem hiding this comment.
https://iceberg.apache.org/contribute/#conventions-and-recommendations
- Omit the public modifier for test classes, test methods, and lifecycle methods for newly added tests.
Suggested change
| public void getLengthMissingBlob() { | |
| void getLengthMissingBlob() { |
Co-authored-by: Yuya Ebihara <6237050+ebyhr@users.noreply.github.com>
rishvin
approved these changes
Nov 21, 2026
|
Thanks @linzch3! LGTM. |
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.
Closes #19047
Background
When a manifest list (or any other file) is deleted from GCS but still referenced by metadata, reading it fails with an NPE instead of a
NotFoundException:Root cause
Storage.get(BlobId)returnsnullfor a missing object (that's also whatBaseGCSFile.exists()relies on).GCSInputFile.getLength()calledgetBlob().getSize()without a null check. #15734 already maps 404s toNotFoundExceptionin the input streams, butgetLength()runs before any stream is opened (e.g.AvroIterable.newFileReader), so the NPE comes first.Fix
If the blob is missing,
getLength()throwsNotFoundException("Location does not exist: %s", location()), the same messageGCSExceptionUtilandS3InputStreamuse. Nothing else changes: a known length still skips the lookup.Tests
TestGcsInputFile#getLengthMissingBlob:storage.getreturnsnull,exists()is false andgetLength()throwsNotFoundExceptionwith the location../gradlew :iceberg-gcp:testand:iceberg-gcp:spotlessCheckpass locally (JDK 21). I didn't run the GCS integration tests (gcp/src/integration), they need the emulator.Limitations
getLength()path is covered here. Other callers ofgetBlob()(exists()) already handlenull.AI disclosure: I used an AI assistant (Claude Opus 5.5) to help write this change and the test. I reviewed the code and ran the tests myself.
Happy to adjust anything, e.g. the message wording or moving the check into
BaseGCSFile, lmk.