nsivabalan commented on a change in pull request #4811:
URL: https://github.com/apache/hudi/pull/4811#discussion_r820354696
##########
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:
from what I see, it was some minor optimization. two if blocks were
combined to one in 4789. not sure if there any bug in rewriteRecord method as
such. Or are you talking about some other fix in the caller?
--
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]