avro - Apache Avro UnresolvedUnionException: Not in union ["null",{"type":"int","logicalType":"date"}]: 2001-01-01
问题描述
尽管在这里和那里收集了示例,但我无法为我的(lomboked)类生成正确的Avro 1.9.1模式,在我的 LocalDate 字段的序列化时获取标题的错误消息。有人可以解释我错过了什么吗?
@Data
public class Person {
private Long id;
private String firstname;
private LocalDate birth;
private Integer votes = 0;
}
这是架构:
{
"type": "record",
"name": "Person",
"namespace": "com.example.demo",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "firstname",
"type": "string"
},
{
"name": "birth",
"type": [ "null", { "type": "int", "logicalType": "date" }]
},
{
"name": "votes",
"type": "int"
}]
}
错误,意思是在联合的“索引命名”映射中找不到 java.time.LocalDate,是这样的:org.apache.avro.UnresolvedUnionException: Not in union ["null",{"type":"int","逻辑类型“:”日期“}]:2001-01-01
索引命名的映射键是“null”和“int”,这似乎是合乎逻辑的。
解决方案
推荐阅读
- javascript - 如何在 Google 时间轴图中的 hAxis 中添加特定时间
- wordpress - 在哪个文件 Wordpress Bitnami 中放置 HTTP 严格传输安全性?
- vb.net - 使用 CheckBox 过滤 DataGridView
- javascript - 使用 javascript 拖放警报
- arrays - 更新 jsonb 对象数组中的键值
- mysql - 我的触发器错误
- r - 在大型栅格时间序列中使用movingFun的最有效方法是什么?
- python-3.x - 如何在 sys.argv[] 代码中传递参数-Python
- reactjs - Office-JS 缺少更多 TypeScript 定义
- python - 如何减少 matplotlib 图上显示的 xticks 数量?