msamirkhan commented on a change in pull request #29354: URL: https://github.com/apache/spark/pull/29354#discussion_r466000481
########## File path: external/avro/src/main/scala/org/apache/spark/sql/avro/SparkAvroDatumReader.scala ########## @@ -638,90 +628,57 @@ class SparkAvroDatumReader[T]( /** Helper functions to create objects */ - private[this] def getRowCreator(st: StructType): () => InternalRow = { - val constructorsArray = new Array[() => MutableValue](st.fields.length) - var i = 0 - while (i < st.fields.length) { - st.fields(i).dataType match { - case BooleanType => constructorsArray(i) = () => new MutableBoolean - case ByteType => constructorsArray(i) = () => new MutableByte - case ShortType => constructorsArray(i) = () => new MutableShort - // We use INT for DATE internally - case IntegerType | DateType => constructorsArray(i) = () => new MutableInt - // We use Long for Timestamp internally - case LongType | TimestampType => constructorsArray(i) = () => new MutableLong - case FloatType => constructorsArray(i) = () => new MutableFloat - case DoubleType => constructorsArray(i) = () => new MutableDouble - case _ => constructorsArray(i) = () => new MutableAny - } - i += 1 - } - () => { - val array = new Array[MutableValue](constructorsArray.length) - var i = 0 - while (i < constructorsArray.length) { - array(i) = constructorsArray(i).apply() - i += 1 - } - new SpecificInternalRow(array) Review comment: Please see https://github.com/apache/spark/pull/29354/commits/6727a3c10dcad0a49620317e058c9a654d042019#r465982616 ---------------------------------------------------------------- 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