linzch3 opened a new pull request, #19063:
URL: https://github.com/apache/iceberg/pull/19063

   Follow-up to #19048, as @ebyhr pointed out in the review there.
   
   ### Background
   `GCSInputStream.readTail()` looks up the blob size with 
`storage.get(blobId).getSize()` when the length isn't known. 
`Storage.get(BlobId)` returns `null` for a missing object, so reading the tail 
of a deleted file throws an NPE instead of a `NotFoundException`. The channel 
reads already map 404s to `NotFoundException` via `GCSExceptionUtil` (#15734), 
but this lookup happens before any channel is opened.
   
   ### Fix
   If the blob is missing, throw `NotFoundException("Location does not exist: 
%s", blobId.toGsUtilUri())`, same message as `GCSExceptionUtil`. A known length 
still skips the lookup.
   
   ### Tests
   - New `TestGCSInputStream#readTailMissingBlob`: `readTail` on a blob that 
doesn't exist (with `LocalStorageHelper`) throws `NotFoundException` with the 
location. It fails with the NPE when the fix is reverted.
   - `./gradlew :iceberg-gcp:test` and `:iceberg-gcp:spotlessCheck` pass 
locally (JDK 21).
   
   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.
   


-- 
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]

Reply via email to