rdblue commented on code in PR #12512:
URL: https://github.com/apache/iceberg/pull/12512#discussion_r2006370387


##########
parquet/src/test/java/org/apache/iceberg/parquet/TestVariantReaders.java:
##########
@@ -900,6 +1176,31 @@ private static GenericRecord record(GroupType type, 
Map<String, Object> fields)
     return record;
   }
 
+  private static <T> List<GenericRecord> elements(Type shreddedType, List<T> 
elements) {
+    GroupType elementType =
+        Types.buildGroup(Type.Repetition.REQUIRED)
+            .addField(
+                Types.primitive(PrimitiveTypeName.BINARY, 
Type.Repetition.OPTIONAL).named("value"))
+            .addField(shreddedType)
+            .named("element");

Review Comment:
   It's a little awkward that the element type is constructed separately here 
and below in the method `GroupType list(Type shreddedType)`. I think it would 
be better to construct the element type and pass it into both.
   
   Doing that also allows you to re-use the `field` method, which constructs a 
group that contains `value` and `typed_value`, with a given name. That makes 
the `element` method simple:
   
   ```java
     private static GroupType element(Type shreddedType) {
       return field("element", shreddedType);
     }
   ```



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