我有一个 java 程序,它以 avro 格式从 Oracle db 写入数据。我在写作时在日期列上遇到了这个异常
org.apache.avro.file.DataFileWriter$AppendWriteException: org.apache.avro.UnresolvedUnionException: Not in union ["null","int"]: 2020-04-01
我正在使用 avro 1.9.2 版本。下面是架构:
{
"type": "record",
"name": "some",
"doc": "SOME",
"namespace": "some.avro",
"fields": [
{
"name": "SOME_DATE",
"type": [
"null",
"int"
],
"logicalType": "date",
"default": null
}
..
]
}
当我将以下模式与字符串一起使用时,它工作正常。
{"name":"SOME_DATE","type": ["null","string"]}