pratyakshsharma commented on a change in pull request #1513: [HUDI-793] Adding
proper default to hudi metadata fields and proper handling to rewrite routine
URL: https://github.com/apache/incubator-hudi/pull/1513#discussion_r408469635
##########
File path: hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java
##########
@@ -206,7 +207,11 @@ private static GenericRecord rewrite(GenericRecord
record, LinkedHashSet<Field>
GenericRecord newRecord = new GenericData.Record(newSchema);
for (Schema.Field f : fieldsToWrite) {
if (record.get(f.name()) == null) {
- newRecord.put(f.name(), f.defaultVal());
+ if (f.defaultVal() instanceof Null) {
+ newRecord.put(f.name(), null);
Review comment:
Ok so when using f.defaultVal(), NullNode corresponds to JsonProperties.Null
class and hence the test case fails. Good catch :)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services