rahil-c commented on code in PR #6155:
URL: https://github.com/apache/hudi/pull/6155#discussion_r927000477
##########
hudi-hadoop-mr/src/main/java/org/apache/hudi/hadoop/utils/HoodieRealtimeRecordReaderUtils.java:
##########
@@ -189,7 +190,13 @@ public static Writable avroToArrayWritable(Object value,
Schema schema) {
Writable[] recordValues = new Writable[schema.getFields().size()];
int recordValueIndex = 0;
for (Schema.Field field : schema.getFields()) {
- recordValues[recordValueIndex++] =
avroToArrayWritable(record.get(field.name()), field.schema());
+ Object fieldValue = null;
+ try {
+ fieldValue = record.get(field.name());
+ } catch (AvroRuntimeException e) {
+ LOG.debug("Field:" + field.name() + "not found in Schema:" +
schema.toString());
Review Comment:
The`GenericRecord` Api does not have the `hasField` method in avro 1.8.2
https://avro.apache.org/docs/1.8.2/api/java/org/apache/avro/generic/GenericRecord.html#hasField-java.lang.String-
so i think in general when it performs this get we have to do some exception
catching i believe.
its only present in the 1.10.2
https://avro.apache.org/docs/1.10.2/api/java/org/apache/avro/generic/GenericRecord.html#hasField-java.lang.String-
--
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]