szehon-ho commented on code in PR #4627:
URL: https://github.com/apache/iceberg/pull/4627#discussion_r1025283707


##########
parquet/src/main/java/org/apache/iceberg/data/parquet/BaseParquetReaders.java:
##########
@@ -149,11 +153,14 @@ public ParquetValueReader<?> struct(Types.StructType 
expected, GroupType struct,
       List<ParquetValueReader<?>> reorderedFields = 
Lists.newArrayListWithExpectedSize(
           expectedFields.size());
       List<Type> types = 
Lists.newArrayListWithExpectedSize(expectedFields.size());
+      // Inferring MaxDefinitionLevel from parent field
+      int inferredMaxDefinitionLevel = 
type.getMaxDefinitionLevel(currentPath());
       for (Types.NestedField field : expectedFields) {
         int id = field.fieldId();
         if (idToConstant.containsKey(id)) {
           // containsKey is used because the constant may be null
-          
reorderedFields.add(ParquetValueReaders.constant(idToConstant.get(id)));
+          int fieldMaxDefinitionLevel = 
maxDefinitionLevelsById.getOrDefault(id, inferredMaxDefinitionLevel);

Review Comment:
   Nit: I still think the name 'inferred' is a bit confusing, it indicates to 
me that it's the one that will be chosen.  Will it be better to call it 
'defaultMaxDefintionLevel' or 'parentMaxDefinitionLevel'? 
   
   Also just curious, what is the example of a case where we need this default 
value? I tried to walk through one example and found the expected field is 
always in the actual struct.



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