msamirkhan commented on a change in pull request #29354: URL: https://github.com/apache/spark/pull/29354#discussion_r465983050
########## File path: external/avro/src/main/scala/org/apache/spark/sql/avro/AvroDeserializer.scala ########## @@ -367,15 +372,45 @@ class AvroDeserializer( } } - private def createArrayData(elementType: DataType, length: Int): ArrayData = elementType match { - case BooleanType => UnsafeArrayData.fromPrimitiveArray(new Array[Boolean](length)) - case ByteType => UnsafeArrayData.fromPrimitiveArray(new Array[Byte](length)) - case ShortType => UnsafeArrayData.fromPrimitiveArray(new Array[Short](length)) - case IntegerType => UnsafeArrayData.fromPrimitiveArray(new Array[Int](length)) - case LongType => UnsafeArrayData.fromPrimitiveArray(new Array[Long](length)) - case FloatType => UnsafeArrayData.fromPrimitiveArray(new Array[Float](length)) - case DoubleType => UnsafeArrayData.fromPrimitiveArray(new Array[Double](length)) - case _ => new GenericArrayData(new Array[Any](length)) + private def getArrayDataCreator(elementType: DataType): Int => ArrayData = elementType match { + case BooleanType => length => UnsafeArrayData.createFreshArray(length, 1) + case ByteType => length => UnsafeArrayData.createFreshArray(length, 1) + case ShortType => length => UnsafeArrayData.createFreshArray(length, 2) + case IntegerType => length => UnsafeArrayData.createFreshArray(length, 4) + case LongType => length => UnsafeArrayData.createFreshArray(length, 8) + case FloatType => length => UnsafeArrayData.createFreshArray(length, 4) + case DoubleType => length => UnsafeArrayData.createFreshArray(length, 8) + case _ => length => new GenericArrayData(new Array[Any](length)) + } Review comment: This has been changed in a later commit. ---------------------------------------------------------------- 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: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org