I have a java program which writes data from Oracle db in avro format. I am getting this exception on a date column while writing
org.apache.avro.file.DataFileWriter$AppendWriteException: org.apache.avro.UnresolvedUnionException: Not in union ["null","int"]: 2020-04-01
I am using avro 1.9.2 version. Below is the schema :
{
"type": "record",
"name": "some",
"doc": "SOME",
"namespace": "some.avro",
"fields": [
{
"name": "SOME_DATE",
"type": [
"null",
"int"
],
"logicalType": "date",
"default": null
}
..
]
}
When I use below schema with string it works fine.
{"name":"SOME_DATE","type": ["null","string"]}
Your schema should look like this:
But then you'll probably get a nasty problem with conversion for union types with default values and logical types inside that union. ))