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


##########
api/src/test/java/org/apache/iceberg/types/TestTypeUtil.java:
##########
@@ -645,4 +647,37 @@ public void testReassignOrRefreshIdsCaseInsensitive() {
                 required(2, "FIELD2", Types.IntegerType.get())));
     assertThat(actualSchema.asStruct()).isEqualTo(expectedSchema.asStruct());
   }
+
+  @Test
+  public void testVariantType() {
+    Schema schema =
+        new Schema(
+            required(0, "v", Types.VariantType.get()), required(1, "A", 
Types.IntegerType.get()));
+    Schema sourceSchema =
+        new Schema(
+            required(1, "v", Types.VariantType.get()), required(2, "A", 
Types.IntegerType.get()));
+
+    Schema assignedSchema =
+        TypeUtil.assignFreshIds(sourceSchema, new 
AtomicInteger(10)::incrementAndGet);
+    Schema expectedSchema =
+        new Schema(
+            required(11, "v", Types.VariantType.get()), required(12, "A", 
Types.IntegerType.get()));
+    assertThat(assignedSchema.asStruct()).isEqualTo(expectedSchema.asStruct());
+
+    final Schema reassignedSchema = TypeUtil.reassignIds(schema, sourceSchema);
+    assertThat(reassignedSchema.asStruct()).isEqualTo(sourceSchema.asStruct());
+
+    expectedSchema = new Schema(Lists.newArrayList(required(1, "v", 
Types.VariantType.get())));
+    Schema projectedSchema = TypeUtil.project(sourceSchema, 
Sets.newHashSet(1));

Review Comment:
   I think that projection should be a different test case.



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