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 Sat, 21 Nov 2015 02:10:01 GMT
On Fri, Nov 20, 2015 at 04:43:29PM -0500, David Lauzon wrote:
>    I don't see a Date data type in the spec:
>    [1]http://avro.apache.org/docs/current/spec.html#schema_primitive
>    I've seen some old discussions in the ML and issues suggesting to
>    serialize it using the UNIX epoch in a long value.
>    However, how do we store events older than 1970 like birthdate ?
> References
>    1. http://avro.apache.org/docs/current/spec.html#schema_primitive

Using ms since UNIX epoch should be fine for dates earlier than 1970 since it
gets stored as a signed long. Dates before 1970 will just have a negative

If you are dealing with dates *really* far in the past (i.e. almost 300 million
years ago) you probably need to do something special.

Evan McClain

View raw message