amogh-jahagirdar commented on code in PR #11831:
URL: https://github.com/apache/iceberg/pull/11831#discussion_r1894351944


##########
api/src/main/java/org/apache/iceberg/transforms/Identity.java:
##########
@@ -39,7 +42,7 @@ class Identity<T> implements Transform<T, T> {
   @Deprecated
   public static <I> Identity<I> get(Type type) {
     Preconditions.checkArgument(
-        type.typeId() != Type.TypeID.VARIANT, "Unsupported type for identity: 
%s", type);
+        !UNSUPPORTED_TYPES.contains(type), "Unsupported type for identity: 
%s", type);

Review Comment:
   I probably wouldn't do this refactoring until there's some other type where 
identity partition isn't supported, but just a nit. 



##########
core/src/test/java/org/apache/iceberg/avro/TestSchemaConversions.java:
##########
@@ -370,4 +370,17 @@ public void testFieldDocsArePreserved() {
         Lists.newArrayList(Iterables.transform(origSchema.columns(), 
Types.NestedField::doc));
     assertThat(fieldDocs).isEqualTo(origFieldDocs);
   }
+
+  @Test
+  public void testVariantConversion() {
+    org.apache.iceberg.Schema schema =
+        new org.apache.iceberg.Schema(required(1, "variantCol", 
Types.VariantType.get()));
+    org.apache.avro.Schema avroSchema = 
AvroSchemaUtil.convert(schema.asStruct());
+
+    org.apache.avro.Schema variantSchema = 
avroSchema.getField("variantCol").schema();
+    
assertThat(variantSchema.getType()).isEqualTo(org.apache.avro.Schema.Type.RECORD);
+    assertThat(variantSchema.getFields().size()).isEqualTo(2);
+    assertThat(variantSchema.getField("metadata")).isNotNull();
+    assertThat(variantSchema.getField("value")).isNotNull();

Review Comment:
   Should we have stronger assertions on the types of these fields (they should 
be bytes)? 



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