xkrogen commented on a change in pull request #31201:
URL: https://github.com/apache/spark/pull/31201#discussion_r560314410



##########
File path: 
external/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala
##########
@@ -330,27 +341,27 @@ private[sql] class AvroDeserializer(
     var i = 0
     while (i < length) {
       val sqlField = sqlType.fields(i)
-      val avroField = avroType.getField(sqlField.name)

Review comment:
       No, it is a constant-time map lookup (from 
`org.apache.avro.Schema.RecordSchema`):
   ```
       public Field getField(String fieldname) {
         if (fieldMap == null)
           throw new AvroRuntimeException("Schema fields not set yet");
         return fieldMap.get(fieldname);
       }
   ```
   I think this is not so performance-critical given that it is executed only 
once per query? It is not done on a per-record basis.




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to