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


##########
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();
+                SchemaBuilder.FieldAssembler<Schema> builder = 
SchemaBuilder.builder(
+                        namespace(name, names))
+                    .record(name)
+                    .fields();
+                builder.name("metadata")
+                    .type(Schema.create(Schema.Type.BYTES))
+                    .noDefault();
+                
builder.name("value").type().optional().type(Schema.create(Schema.Type.BYTES));
+                return of(builder.endRecord());

Review Comment:
   I think we should also add a `variant` logical type name to the record.



##########
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();
+                SchemaBuilder.FieldAssembler<Schema> builder = 
SchemaBuilder.builder(
+                        namespace(name, names))
+                    .record(name)
+                    .fields();
+                builder.name("metadata")
+                    .type(Schema.create(Schema.Type.BYTES))
+                    .noDefault();
+                
builder.name("value").type().optional().type(Schema.create(Schema.Type.BYTES));
+                return of(builder.endRecord());

Review Comment:
   I think we should also add a `variant` logical type name to the record. 
Probably not blocking though.



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