[
https://issues.apache.org/jira/browse/AVRO-1360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13758281#comment-13758281
]
Ramana Suvarapu commented on AVRO-1360:
---------------------------------------
Hi Thiru,
I am trying to generate code for below record schema with one of the field is
union type and it has default value null. During the compileJsonSchema phase,
avrogencpp crashes due to “Access violation writing location
0x0000000000000000”.
I debugged the code and there is a bug in void selectBranch(size_t branch,
const T& v) of GenericUnion and GenericDatum(const NodePtr& schema, const T& v)
constructor when dealing with null types.
{
"type" : "record",
"name" : "MyRecord",
"namespace" : "com.baml.gmrt.messaging.avro.tester",
"fields" : [ {
"name" : "unionTest1",
"type" : [ "string", "null" ],
"default": null,
"declared" : "true"
}]
}
This is a blocker for us as our schema as lot of union type fields with null
default values. Please fix this issue at the earliest. I attached sample schema
and to https://issues.apache.org/jira/browse/AVRO-1360.
Thanks,
Ramana
> C++ Resolving decoder is not working when reader schema has more fields than
> writer schema
> ------------------------------------------------------------------------------------------
>
> Key: AVRO-1360
> URL: https://issues.apache.org/jira/browse/AVRO-1360
> Project: Avro
> Issue Type: Bug
> Components: c++
> Affects Versions: 1.7.4
> Reporter: Ramana Suvarapu
> Assignee: Thiruvalluvan M. G.
> Attachments: AVRO-1360-2.patch, AVRO-1360.patch, testreader,
> testreader.hh, testwriter, testwriter.hh
>
>
> When reader schema has more number of fields than writer schema, C++
> implementation of resolving decoder is throwing exception "throwing exception
> "Don't know how to handle excess fields for reader.” with out checking
> whether fields are optional or fields have default values.
> Attached are reader and writer schemas. Record in reader schema has 2
> additional fields than writer schema. One field is required field but it has
> default value and another one is optional field (union of null and string).
> Since one has default value and another is optional both reader and writer
> schemas are supposed to be compatible.
>
> {"name": "defaultField", "type": "string", "default": "DEFAULT",
> "declared":"true"},
> {"name": "optionalField", "type": ["string", "null"],"declared":"true"},
>
> main()
> {
> avro::ValidSchema readerSchema = load("reader.json");
> avro::ValidSchema writerSchema = load("writer.json");
> avro::DecoderPtr d = avro::resolvingDecoder(writerSchema,
> readerSchema,avro::binaryDecoder());
> }
>
> But when I tried to create resolving decoder, I am getting "Don't know how to
> handle excess fields for reader.” But Java implementation works.
>
> Can you please let us know if there are any other limitations with c++
> implementation of ResolvingDecoder? We are planning to use it in our project
> and we want to make sure it works as per avro specification.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira