avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evan McClain <aeroe...@gmail.com>
Subject Re: What is the recommended way to store a Date field in Avro ?
Date Sun, 22 Nov 2015 20:51:34 GMT
On Sun, Nov 22, 2015 at 03:00:25PM -0500, David Lauzon wrote:
>    300 million years is more than enough :-)
>    Is there a way to get this long to deserialize automatically to a Java
>    7 compatible type, like java.util.Date ?
>    (I'm using a framework which currently has issues on JDK 8).

If you are using reflection to encode POJOs as avro, it's easy enough to do
with DateAsLongEncoding:

Date someDate;

See: https://avro.apache.org/docs/1.7.7/api/java/org/apache/avro/reflect/DateAsLongEncoding.html

And it's fairly easy to write your own encoder for java 8 java.time.Instant
when you can upgrade to java 8.

Evan McClain

View raw message