Github user dbtsai commented on a diff in the pull request: https://github.com/apache/spark/pull/22094#discussion_r209826949 --- Diff: external/avro/src/main/scala/org/apache/spark/sql/avro/AvroSerializer.scala --- @@ -72,62 +73,70 @@ class AvroSerializer(rootCatalystType: DataType, rootAvroType: Schema, nullable: private lazy val decimalConversions = new DecimalConversion() private def newConverter(catalystType: DataType, avroType: Schema): Converter = { - catalystType match { - case NullType => + (catalystType, avroType.getType) match { + case (NullType, NULL) => (getter, ordinal) => null - case BooleanType => + case (BooleanType, BOOLEAN) => (getter, ordinal) => getter.getBoolean(ordinal) - case ByteType => + case (ByteType, INT) => (getter, ordinal) => getter.getByte(ordinal).toInt - case ShortType => + case (ShortType, INT) => (getter, ordinal) => getter.getShort(ordinal).toInt - case IntegerType => + case (IntegerType, INT) => (getter, ordinal) => getter.getInt(ordinal) - case LongType => + case (LongType, LONG) => (getter, ordinal) => getter.getLong(ordinal) - case FloatType => + case (FloatType, FLOAT) => (getter, ordinal) => getter.getFloat(ordinal) - case DoubleType => + case (DoubleType, DOUBLE) => --- End diff -- Yeah, if someone feels it's important, let's do it in different PR.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org