Java 8的Avro日期为逻辑类型 [英] Avro with Java 8 dates as logical type

查看:702
本文介绍了Java 8的Avro日期为逻辑类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆