c-thiel opened a new pull request, #14064:
URL: https://github.com/apache/iceberg/pull/14064

   While implementing V3 support in Rust, I noticed an unhandled case in Java, 
which, Java beeing Java, can lead to a NPE. This PR includes a test to 
reproduce the issue. 
   
   In V1 tables, `existing_rows_count` and `added_rows_count` is optional. When 
parsed into a `GenericManifestFile`, it is thus [parsed as 
optional](https://github.com/apache/iceberg/blob/723d0998d69f254822efd6f8939e71c0723aaab2/core/src/main/java/org/apache/iceberg/ManifestFileParser.java#L121).
   
   When this (data) manifest is now added to a new Snapshot in a V3 table, we 
prepare the manifest:
   
https://github.com/apache/iceberg/blob/723d0998d69f254822efd6f8939e71c0723aaab2/core/src/main/java/org/apache/iceberg/ManifestListWriter.java#L158-L166
   
   The if condition doesn't match, as `firstRowId` is also null for V1 
Manifests.
   In the else clause we inevitably hit `this.nextRowId += 
manifest.existingRowsCount() + manifest.addedRowsCount();`, where both summands 
can be null, hence leading to a NPE.
   
   I talked with @RussellSpitzer, and we believe the proper thing to do here is 
to throw an exception, which this PR implements.
   


-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to