rdblue commented on code in PR #3212:
URL: https://github.com/apache/parquet-java/pull/3212#discussion_r2085681482


##########
parquet-avro/src/main/java/org/apache/parquet/avro/AvroSchemaConverter.java:
##########
@@ -466,6 +466,21 @@ public Optional<Schema> visit(
                   LogicalTypeAnnotation.EnumLogicalTypeAnnotation 
enumLogicalType) {
                 return of(Schema.create(Schema.Type.STRING));
               }
+
+              @Override
+              public Optional<Schema> visit(
+                  LogicalTypeAnnotation.VariantLogicalTypeAnnotation 
variantLogicalType) {
+                String name = parquetGroupType.getName();

Review Comment:
   I wouldn't recommend using the schema builder. It has proven to be a 
confusing API because you can't really understand exactly what gets created. I 
think the normal API is much more clear and succinct:
   
   ```java
                   List<Schema.Field> fields = new ArrayList<>();
                   fields.add(new Schema.Field("metadata", 
Schema.create(Schema.Type.BYTES)));
                   fields.add(new Schema.Field("value", 
Schema.create(Schema.Type.BYTES)));
                   return of(Schema.createRecord(parquetGroupType.getName(), 
null, namespace(name, names), false, fields));
   ```
   
   That corresponds to what we do in Iceberg: 
https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/avro/TypeToSchema.java#L199-L209



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