Java 8的Avro日期为逻辑类型 [英] Avro with Java 8 dates as logical type
问题描述
最新的Avro编译器(1.8.2)为日期逻辑生成java源代码类型与基于Joda-Time 的实施。如何配置Avro编译器以生成使用Java 8日期时间API的源?
Latest Avro compiler (1.8.2) generates java sources for dates logical types with Joda-Time based implementations. How can I configure Avro compiler to produce sources that used Java 8 date-time API?
推荐答案
目前(avro 1.8.2)这是不可能的。它是硬编码生成Joda日期/时间类。
Currently (avro 1.8.2) this is not possible. It's hardcoded to generate Joda date/time classes.
当前主
分支已切换到Java 8,并且 open issue (带拉取请求)添加使用 java.time。*
类型生成类的功能。
The current master
branch has switched to Java 8 and there is an open issue (with Pull Request) to add the ability to generate classes with java.time.*
types.
遗憾的是,我不知道目前在 master
中的任何类型的发布时间表。如果您喜欢冒险,可以将补丁应用于 1.8.2
,因为理论上它应该都是兼容的。序列化/反序列化时的基础类型仍然是整数和长整数。
I have no idea on any kind of release schedule for whatever is currently in master
unfortunately. If you feel adventurous you can apply the patch to 1.8.2
, since in theory it should all be compatible. The underlying base types when serializing / deserializing are still integers and longs.
这篇关于Java 8的Avro日期为逻辑类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!