【问题标题】:Execution default of goal org.apache.avro:avro-maven-plugin:1 .10.2:schema failed: Invalid default for field目标 org.apache.avro:avro-maven-plugin:1 .10.2:schema 的执行默认值失败:字段默认值无效
【发布时间】:2021-07-27 18:17:18
【问题描述】:

在执行 avro-maven-plugin:schema 目标期间,我不断收到此错误:

[ERROR] Failed to execute goal org.apache.avro:avro-maven-plugin:1.10.2:schema (default) on project test: Execution default of goal org.apache.avro:avro-maven-plugin:1
.10.2:schema failed: Invalid default for field someId: null not a ["int","null"] -> [Help 1]

这就是该字段在架构中的样子:

{
    "name" : "someId",
    "type" : [ "int", "null" ],
    "default" : null
}

根据https://json-schema-validator.herokuapp.com/avro.jsp,架构是有效的。

有谁知道出了什么问题以及如何解决?

提前谢谢...

【问题讨论】:

    标签: java avro


    【解决方案1】:

    规范规定默认值必须匹配联合的第一个元素:https://avro.apache.org/docs/current/spec.html#Unions

    因此,您需要将联合的顺序更改为首先具有null 类型,或者将默认值更改为整数类型。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-30
      • 2019-12-23
      • 2018-07-31
      • 2020-05-19
      • 1970-01-01
      • 2016-09-22
      • 2016-10-05
      • 2017-09-19
      相关资源
      最近更新 更多