avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "qilin2004-avro@yahoo.com" <qilin2004-a...@yahoo.com>
Subject Projection using C value API
Date Wed, 21 Dec 2011 05:53:13 GMT
(Apologies, resending with subject line)


With the legacy datum API one could create a read record schema with a subset of the fields
in the write record schema. And then call avro_file_reader_read which takes the read schema
as one of the parameters. That call would then correctly read inĀ  just the subset of the
fields as defined in the read schema. But I can't seem to do the same with the new API.

My read code does:

iface = avro_generic_class_from_schema(read_schema);
avro_generic_value_new(iface, &avro_record);
avro_file_reader(filename, &reader);
avro_file_reader_read_value(reader, &avro_record);

If the read schema is the same as the write schema then all is well. But if the read schema
has only a subset of the fields in the write schema avro_file_reader_read_value gets an error
with error string "Incorrect sync bytes".

Am I doing something wrong here? If so, what is the right way to achieve such a projection



View raw message