FelixGV commented on code in PR #11698:
URL: https://github.com/apache/pinot/pull/11698#discussion_r1339410257


##########
pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroRecordExtractor.java:
##########
@@ -74,7 +74,7 @@ public GenericRow extract(GenericRecord from, GenericRow to) {
       }
     } else {
       for (String fieldName : _fields) {
-        Object value = from.get(fieldName);
+        Object value = from.hasField(fieldName) ? from.get(fieldName) : null;

Review Comment:
   It is true that this introduces an extra lookup. In Venice, we have 
maintained the single lookup like this: 
https://github.com/linkedin/venice/blob/main/internal/venice-client-common/src/main/java/com/linkedin/venice/compute/ComputeUtils.java#L382
   
   In the context of the Pinot code here, the solution could look like this:
   
   ```
   Field field = from.getSchema().getField(fieldName);
   Object value = field == null ? null : from.get(field.pos());
   ```
   
   This works on `GenericRecord`. No need to cast or change the type.



-- 
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: commits-unsubscr...@pinot.apache.org

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