One option is:

    @logicalType("localdate")
    record Date {
        /** the year */
        int year;
        /** the month of year */
        int month;
        /** the day of month */
        int day;
    }

If you want to , you should be able to  use the logicalType facility to map it 
to an existing type…


--Z

From: David Lauzon [mailto:davidonlap...@gmail.com]
Sent: Friday, November 20, 2015 4:43 PM
To: user@avro.apache.org
Subject: What is the recommended way to store a Date field in Avro ?

I don't see a Date data type in the spec:
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 ?
This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee, you should not 
disseminate, distribute, alter or copy this e-mail. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system. E-mail transmissions cannot be guaranteed to be 
secure or without error as information could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. The sender, 
therefore, does not accept liability for any errors or omissions in the 
contents of this message which arise during or as a result of e-mail 
transmission. If verification is required, please request a hard-copy version. 
This message is provided for information purposes and should not be construed 
as a solicitation or offer to buy or sell any securities or related financial 
instruments in any jurisdiction.  Securities are offered in the U.S. through 
PIMCO Investments LLC, distributor and a company of PIMCO LLC.

Reply via email to