timsants commented on a change in pull request #6046:
URL: https://github.com/apache/incubator-pinot/pull/6046#discussion_r503039737



##########
File path: 
pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java
##########
@@ -49,13 +51,53 @@ public GenericRow extract(GenericRecord from, GenericRow 
to) {
       List<Schema.Field> fields = from.getSchema().getFields();
       for (Schema.Field field : fields) {
         String fieldName = field.name();
-        to.putValue(fieldName, AvroUtils.convert(from.get(fieldName)));
+        Object value = from.get(fieldName);
+        if (value != null) {
+          value = convert(value);
+        }
+        to.putValue(fieldName, value);
       }
     } else {
       for (String fieldName : _fields) {
-        to.putValue(fieldName, AvroUtils.convert(from.get(fieldName)));
+        Object value = from.get(fieldName);
+        if (value != null) {
+          value = convert(value);
+        }
+        to.putValue(fieldName, value);
       }
     }
     return to;
   }
+
+  /**
+   * Returns whether the object is an Avro GenericRecord.
+   */
+  @Override
+  protected boolean isInstanceOfRecord(Object value) {
+    return value instanceof GenericRecord;
+  }
+
+  /**
+   * Handles the conversion of every field of the Avro GenericRecord.
+   */
+  @Override
+  @Nullable
+  protected Object convertRecord(Object value) {

Review comment:
       That's a good idea. Adding a description to these javadocs.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to