gpt4 book ai didi

serialization - 获取架构反序列化错误 : Invalid default for field

转载 作者:行者123 更新时间:2023-12-04 01:05:23 24 4
gpt4 key购买 nike

在运行 kafka 消费者时,我收到以下错误:

Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 13
Caused by: org.apache.avro.AvroTypeException: Invalid default for field key_id: "null" not a ["null",{"type":"string","avro.java.string":"String"}]
at org.apache.avro.Schema.validateDefault(Schema.java:1512)
at org.apache.avro.Schema.access$300(Schema.java:86)
at org.apache.avro.Schema$Field.<init>(Schema.java:493

我的 avro 架构是这样的:
{ "name": "key_id", "type": [ "null", "string" ], "default": "null"},

我尝试了多种选择来解决这个问题,但它仍然存在。

最佳答案

您需要设置"default": null ,而不是 "default":"null" :

{ "name": "key_id", "type": [ "null", "string" ], "default": null},

关于serialization - 获取架构反序列化错误 : Invalid default for field,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57094629/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com