rdblue commented on code in PR #11831:
URL: https://github.com/apache/iceberg/pull/11831#discussion_r1942101398
##########
core/src/test/java/org/apache/iceberg/avro/TestBuildAvroProjection.java:
##########
@@ -401,4 +402,31 @@ public void projectMapWithLessFieldInValueSchema() {
.as("Unexpected value ID discovered on the projected map schema")
.isEqualTo(1);
}
+
+ @Test
+ public void projectVariantSchemaUnchanged() {
+ final Type icebergType = Types.VariantType.get();
+
+ final org.apache.avro.Schema expected =
+ SchemaBuilder.record("variant")
+ .prop(AvroSchemaUtil.FIELD_ID_PROP, "1")
+ .namespace("unit.test")
+ .fields()
+ .name("metadata")
+ .type()
+ .bytesType()
+ .noDefault()
+ .name("value")
+ .type()
+ .bytesType()
+ .noDefault()
+ .endRecord();
+
+ final BuildAvroProjection testSubject =
+ new BuildAvroProjection(icebergType, Collections.emptyMap());
+ final org.apache.avro.Schema actual = testSubject.record(expected,
List.of(), null);
+ assertThat(actual)
+ .as("Variant projection produced undesired variant schema")
+ .isEqualTo(expected);
Review Comment:
I don't think that this is going to exercise the path that we want to when
the visitor and visit method are updated. This should create a record schema
and validate that visiting a file schema gives the correct projection to
request, by name.
--
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]