Github user dbtsai commented on a diff in the pull request: https://github.com/apache/spark/pull/21952#discussion_r207405634 --- Diff: external/avro/src/main/scala/org/apache/spark/sql/avro/AvroSerializer.scala --- @@ -100,13 +100,14 @@ class AvroSerializer(rootCatalystType: DataType, rootAvroType: Schema, nullable: et, resolveNullableType(avroType.getElementType, containsNull)) (getter, ordinal) => { val arrayData = getter.getArray(ordinal) - val result = new java.util.ArrayList[Any] + val len = arrayData.numElements() + val result = new Array[Any](len) --- End diff -- I tested this out, and this doesn't help much. I guess the reason is the avro writer is expecting a boxed `ArrayList`, so even we call the primitive APIs, Scala will still do the auto-boxing which will not be much different than the current code.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org