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


##########
core/src/main/java/org/apache/iceberg/avro/TypeToSchema.java:
##########
@@ -49,6 +49,15 @@ abstract class TypeToSchema extends 
TypeUtil.SchemaVisitor<Schema> {
   private static final Schema UUID_SCHEMA =
       LogicalTypes.uuid().addToSchema(Schema.createFixed("uuid_fixed", null, 
null, 16));
   private static final Schema BINARY_SCHEMA = Schema.create(Schema.Type.BYTES);
+  private static final Schema VARIANT_SCHEMA =

Review Comment:
   You are right. We need to have different name for each record, otherwise, it 
will generate only one record.
   
   I generate a new record with the name generated from field ID now. I don't 
cache it since the type is the same.  
   
   This is the schema with two variant columns:
   
`{"name":"_v1","type":["null",{"type":"record","name":"r18","fields":[{"name":"metadata","type":"bytes"},{"name":"value","type":"bytes"}]}],"default":null,"field-id":18},{"name":"_v2","type":["null",{"type":"record","name":"r19","fields":[{"name":"metadata","type":"bytes"},{"name":"value","type":"bytes"}]}],"default":null,"field-id":19}]}`



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