codope commented on a change in pull request #4811:
URL: https://github.com/apache/hudi/pull/4811#discussion_r820169438
##########
File path: hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java
##########
@@ -382,10 +382,36 @@ public static GenericRecord rewriteRecord(GenericRecord
oldRecord, Schema newSch
return newRecord;
}
+ public static GenericRecord rewriteRecord(GenericRecord genericRecord,
Schema newSchema, boolean copyOverMetaFields, GenericRecord fallbackRecord) {
+ GenericRecord newRecord = new GenericData.Record(newSchema);
+ boolean isSpecificRecord = genericRecord instanceof SpecificRecordBase;
+ for (Schema.Field f : newSchema.getFields()) {
+ if (!isSpecificRecord) {
+ copyOldValueOrSetDefault(genericRecord, newRecord, f);
+ } else if (!isMetadataField(f.name())) {
+ copyOldValueOrSetDefault(genericRecord, newRecord, f);
+ }
Review comment:
I think there was some bug with this logic which was fixed in #4789 .
Can we keep this block of if-else consistent with what we have in
`rewriteRecord(GenericRecord oldRecord, Schema newSchema)`?
--
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]