-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-24772][SQL] Avro: support logical date type #21984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,7 +92,7 @@ class AvroSerializer(rootCatalystType: DataType, rootAvroType: Schema, nullable: | |
| case BinaryType => | ||
| (getter, ordinal) => ByteBuffer.wrap(getter.getBinary(ordinal)) | ||
| case DateType => | ||
| (getter, ordinal) => getter.getInt(ordinal) * DateTimeUtils.MILLIS_PER_DAY | ||
| (getter, ordinal) => getter.getInt(ordinal) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the write path, let's drop the previous conversion to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this cause a behaviour change comparing to the third party one?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it is a real behavior change. The only concern is that the Avro file with date type column is written with this built-in package, and read by third party one with user specify schema. The case should be very trivial and we can ignore that.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are 2 kinds of compatibilities:
I think we should focus on 1) and ignore 2) |
||
| case TimestampType => avroType.getLogicalType match { | ||
| case _: TimestampMillis => (getter, ordinal) => getter.getLong(ordinal) / 1000 | ||
| case _: TimestampMicros => (getter, ordinal) => getter.getLong(ordinal) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: spark-avo -> spark-avro.