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

一曲冷凌霜 提交于 2019-12-08 08:51:28

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/55607244/what-is-the-proper-way-to-declare-a-simple-timestamp-in-avro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!