cashmand commented on code in PR #3258:
URL: https://github.com/apache/parquet-java/pull/3258#discussion_r2258022900


##########
parquet-avro/src/main/java/org/apache/parquet/avro/AvroVariantConverter.java:
##########
@@ -77,9 +84,9 @@ public void end() {
 
     builder.appendNullIfEmpty();
 
-    Object record = model.newRecord(null, avroSchema);
-    model.setField(record, "metadata", metadataPos, 
metadata.getEncodedBuffer());
-    model.setField(record, "value", valuePos, builder.encodedValue());
+    Object record = model.newRecord(null, VARIANT_SCHEMA);

Review Comment:
   I think the intent was the parquet schema should be the shredding schema, 
but the Avro schema provided for Variant should always be a record of `(value, 
metadata)`, even if the parquet schema doesn't contain `value`. So as @rdblue, 
we should reject the schema if that isn't what was provided for a Variant 
column.



##########
parquet-avro/src/main/java/org/apache/parquet/avro/AvroVariantConverter.java:
##########
@@ -77,9 +84,9 @@ public void end() {
 
     builder.appendNullIfEmpty();
 
-    Object record = model.newRecord(null, avroSchema);
-    model.setField(record, "metadata", metadataPos, 
metadata.getEncodedBuffer());
-    model.setField(record, "value", valuePos, builder.encodedValue());
+    Object record = model.newRecord(null, VARIANT_SCHEMA);

Review Comment:
   I think the intent was the parquet schema should be the shredding schema, 
but the Avro schema provided for Variant should always be a record of `(value, 
metadata)`, even if the parquet schema doesn't contain `value`. So as @rdblue 
said, we should reject the schema if that isn't what was provided for a Variant 
column.



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