huaxingao commented on code in PR #14261:
URL: https://github.com/apache/iceberg/pull/14261#discussion_r2407057237


##########
parquet/src/test/java/org/apache/iceberg/parquet/TestPruneColumns.java:
##########
@@ -270,4 +273,64 @@ public void testStructElementName() {
     MessageType actual = ParquetSchemaUtil.pruneColumns(fileSchema, 
projection);
     assertThat(actual).as("Pruned schema should be 
matched").isEqualTo(expected);
   }
+
+  @Test
+  public void testVariant() {
+    MessageType fileSchema =
+        Types.buildMessage()
+            .addField(
+                Types.primitive(PrimitiveTypeName.INT32, 
Type.Repetition.REQUIRED)
+                    .id(1)
+                    .named("id"))
+            .addField(
+                Types.buildGroup(Type.Repetition.OPTIONAL)
+                    .as(LogicalTypeAnnotation.variantType((byte) 1))
+                    .addField(
+                        Types.primitive(PrimitiveTypeName.BINARY, 
Type.Repetition.REQUIRED)
+                            .named("metadata"))
+                    .addField(
+                        Types.primitive(PrimitiveTypeName.BINARY, 
Type.Repetition.REQUIRED)
+                            .named("value"))
+                    .id(2)
+                    .named("variant_1"))
+            .addField(
+                Types.buildGroup(Type.Repetition.OPTIONAL)
+                    .as(LogicalTypeAnnotation.variantType((byte) 1))
+                    .addField(
+                        Types.primitive(PrimitiveTypeName.BINARY, 
Type.Repetition.REQUIRED)
+                            .named("metadata"))
+                    .addField(
+                        Types.primitive(PrimitiveTypeName.BINARY, 
Type.Repetition.REQUIRED)
+                            .named("value"))
+                    .id(3)
+                    .named("variant_2"))
+            .named("table");
+
+    Schema projection =
+        new Schema(
+            List.of(

Review Comment:
   nit: Iceberg typically uses ImmutableList.of()



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