You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Nicolas Ranc <rn...@gmail.com> on 2016/08/24 06:57:59 UTC

Avro decoding - Access Values / Types

Hello,
I'm using Avro c++ and i would like to decode files : access to values and
types of each variable.

I'm doing this with a lot of condition :

//For values
Json Value::val;
   IF val.isString()
        if(val=="name")
            Add the next name in a vector ...

//For Types i do the same with a vector of vector of vector because each
type can be an array like //["int","null"]...

The problem is that i can have records with records with array... and i
think my solution doesn't work with a big file.

That's why i would like to use avro::Decode or avro::DataFileReaderBase to
access to all  values/types.

avro::DataFileReaderBase decode("test.bin");
decode.init();
decode.readerSchema().toJson(std::cout);

With this i can put on my screen the json file.
Which functions i can use now to store/acces of each names (like
first_name, last_name) / types (like string) in my file ?

Thanks,
Nicolas