avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mahesh V <maheshvenkateshwa...@gmail.com>
Subject avro accessing record within an array in C
Date Tue, 24 Sep 2013 15:33:12 GMT
Hi,

given a schema as shown below, how can I set values
to the record "array_record_1" in the array below.?

Any help will be appreciated.
thanks
Mahesh

 avro_schema_t  array_schema = avro_schema_get_subschema(sw_schema,
"some_array");
 array_datum = avro_array(array_schema);
^^^^^ this works fine.

 avro_schema_t array_rec_schema = avro_schema_get_subschema(sw_schema,
"array_record_1");
  array_rec_datum = avro_record(array_rec_schema);
^^^^ this fails

char *some_schema =
"{"
"\"type\":\"record\", \"name\" : \"some_schema\", \"fields\": [ "
"{ \"name\" : \"some_var_a\" , \"type\" : \"int\" },"
"{"
"\"name\" : \"some_ip\", \"type\" : {"
"\"type\":\"record\", \"name\" : \"some_ip\", \"fields\" : [ "
" { \"name\" : \"ip_version\", \"type\" : \"int\" },"
" { \"name\" : \"ip_v4\", \"type\" : \"long\" },"
" { \"name\" : \"ip_v6\", \"type\" : \"string\" }"
"]}},"
"{ \"name\" : \"some_array\" , \"type\" : "
" { \"type\":\"array\", \"items\": "
"{"
"\"type\":\"record\", \"name\" : \"array_record_1\", \"fields\": [ "
"{ \"name\" : \"array_record_var_1\" , \"type\" : \"int\" },"
"{ \"name\" : \"array_record_var_2\" , \"type\" : \"boolean\" } "
"]"
"}"

Mime
View raw message