xndai commented on code in PR #17560:
URL: https://github.com/apache/iceberg/pull/17560#discussion_r3786605380


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetValueWriters.java:
##########
@@ -56,12 +58,38 @@ private ParquetValueWriters() {}
   public static <T> ParquetValueWriter<T> option(
       Type type, int definitionLevel, ParquetValueWriter<T> writer) {
     if (type.isRepetition(Type.Repetition.OPTIONAL)) {
-      return new OptionWriter<>(definitionLevel, writer);
+      return new OptionWriter<>(definitionLevel, writer, 
optionalLeafIds(type));
     }
 
     return writer;
   }
 
+  /**
+   * Collects the ids of optional primitive leaves within a type. A null 
written for an optional
+   * value is also a null for these fields, but not for required fields, whose 
null count is left as
+   * it was before (per the spec, null counts are only tracked for optional 
fields).
+   */
+  private static Set<Integer> optionalLeafIds(Type type) {

Review Comment:
   Same as above. And thanks for the general guides.



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