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


##########
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");
+    org.apache.avro.Schema elementSchema = avroSchema(elementType);
+
+    List<GenericRecord> elementRecords = Lists.newArrayList();
+    if (elements != null) {
+      for (T element : elements) {
+        GenericRecord elementRecord = new GenericData.Record(elementSchema);

Review Comment:
   Could you use the `record` factory method instead? It would be 
`record(elementType, Map.of("typed_value", element))`. That way we don't have 
different ways of constructing these.



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