You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Francois Forster <fr...@bazaarvoice.com> on 2011/12/09 01:00:26 UTC

Multiple records in a single schema in C++

Hi there,
I'm trying to define a record with a sub-record and keep getting an error.
I modified the example cpx.json as follows:

[
{
    "type": "record",
    "name": "cpy",
    "fields" : [
        {"name": "re", "type": "double"},
        {"name": "im", "type" : "double"}
    ]
}
,
{
    "type": "record",
    "name": "cpx",
    "fields" : [
        {"name": "re", "type": "double"},
        {"name": "im", "type" : "double"},
        {"name": "opt", "type" : union ["null","cpy"]}
    ]
}
]

And get the following error:

terminate called after throwing an instance of 'avro::Exception'
  what():  Invalid operation. Expected: Double got Union
union Aborted

Is the schema supposed to be formatted differently?

Thanks,

Francois.