Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/21935#discussion_r206983421
--- Diff:
external/avro/src/main/scala/org/apache/spark/sql/avro/AvroSerializer.scala ---
@@ -93,7 +94,11 @@ class AvroSerializer(rootCatalystType: DataType,
rootAvroType: Schema, nullable:
case DateType =>
(getter, ordinal) => getter.getInt(ordinal) *
DateTimeUtils.MILLIS_PER_DAY
case TimestampType =>
- (getter, ordinal) => getter.getLong(ordinal) / 1000
+ (getter, ordinal) => avroType.getLogicalType match {
+ case _: TimestampMillis => getter.getLong(ordinal) / 1000
+ case _: TimestampMicros => getter.getLong(ordinal)
+ case _ => getter.getLong(ordinal)
--- End diff --
ditto
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]