avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Francois Forster <francois.fors...@bazaarvoice.com>
Subject RE: Multiple records in a single schema in C++
Date Mon, 12 Dec 2011 14:48:00 GMT
Defining the records in nested format did the trick.

Thanks.

Francois.

-----Original Message-----
From: Doug Cutting [mailto:cutting@apache.org] 
Sent: Friday, December 09, 2011 3:10 PM
To: user@avro.apache.org
Subject: Re: Multiple records in a single schema in C++

On 12/09/2011 12:57 PM, Francois Forster wrote:
>         {"name": "opt", "type" : union ["null","cpy"]}

That should probably instead be just:

 {"name": "opt", "type" : ["null","cpy"]}

without the keyword 'union'.  Could that be causing the error?

You could also define the nested record inline, with:

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

either should work.

Doug

Mime
View raw message