aihuaxu commented on code in PR #14588:
URL: https://github.com/apache/iceberg/pull/14588#discussion_r2530634024


##########
parquet/src/test/java/org/apache/iceberg/parquet/TestParquetSchemaUtil.java:
##########
@@ -224,7 +237,16 @@ public void testSchemaConversionWithoutAssigningIds() {
                 "map_col_5",
                 Repetition.REQUIRED,
                 primitive(28, "k", PrimitiveTypeName.INT32, 
Repetition.REQUIRED),
-                primitive(29, "v", PrimitiveTypeName.INT32, 
Repetition.REQUIRED)));
+                primitive(29, "v", PrimitiveTypeName.INT32, 
Repetition.REQUIRED)),
+            variant(30, "variant_col_1", Repetition.OPTIONAL),
+            variant(null, "variant_col_2", Repetition.REQUIRED),
+            list(31, "list_col_6", Repetition.OPTIONAL, variant(32, "v", 
Repetition.OPTIONAL)),

Review Comment:
   Can we also add a test with a variant in map?



##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetTypeVisitor.java:
##########
@@ -46,6 +46,8 @@ public static <T> T visit(Type type, ParquetTypeVisitor<T> 
visitor) {
         return visitList(group, visitor);
       } else if (LogicalTypeAnnotation.mapType().equals(annotation)) {
         return visitMap(group, visitor);
+      } else if (LogicalTypeAnnotation.variantType((byte) 
1).equals(annotation)) {

Review Comment:
   nit: use `Variant.VARIANT_SPEC_VERSION` instead of hardcoded 1.



##########
parquet/src/test/java/org/apache/iceberg/parquet/TestParquetSchemaUtil.java:
##########
@@ -464,4 +502,18 @@ private Type map(Integer id, String name, Repetition 
repetition, Type keyType, T
     }
     return builder.named(name);
   }
+
+  private Type variant(Integer id, String name, Repetition repetition) {
+    GroupBuilder<GroupType> builder =
+        org.apache.parquet.schema.Types.buildGroup(repetition)
+            
.as(org.apache.parquet.schema.LogicalTypeAnnotation.variantType((byte) 1))

Review Comment:
   Same here. Use `Variant.VARIANT_SPEC_VERSION` instead of 1.



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