mxm commented on code in PR #12049:
URL: https://github.com/apache/iceberg/pull/12049#discussion_r1937936596


##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java:
##########
@@ -498,6 +498,12 @@ private static class RowDataWriter extends 
ParquetValueWriters.StructWriter<RowD
 
     @Override
     protected Object get(RowData struct, int index) {
+      // Be sure to check for null values, even if the field is required. 
Without an explicit null
+      // check, BinaryRowData will ignore the null flag and parse random bytes 
as actual values.
+      // This will produce incorrect writes instead of failing with a 
NullPointerException.
+      if (struct.isNullAt(index)) {
+        return null;
+      }

Review Comment:
   You are right. I revised the approach because it was too easy to miss 
instances. I'm instead wrapping RowData#createFieldGetter to make sure to 
null-check also for required / NonNull types. I'll raise an issue on the Flink 
side as well.



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