Search code examples
hivetimestampbigdataavro

What is the proper way to declare a simple Timestamp in Avro


How can we declare a simple timestamp in Avro please.

type:timestamp doesnt work. So I actually use a simple string but I want it as a timestamp. (this is my variable: 27/01/1999 08:45:34 )

Thank you


Solution

  • Use Avro's logical type:

     {"name":"timestamp","type": {"type": "string", "logicalType": "timestamp-millis"}
    

    Few useful links:

    Avro timestamp-millis

    Avro Logical types

    Hortonworks community question about Avro timestamp