I would like to access to elements' names inside an array of records with
Apache Avro. I can use avro::Parser to access to each value inside a simple
record and primitive value inside an array.

avro::Parser has 3 majors methods.

  friend Type nextType(Parser<ValidatingReader> &p);
  friend bool currentRecordName(Parser<ValidatingReader> &p, std::string name);
  friend bool nextFieldName(Parser<ValidatingReader> &p, std::string &name);

I use it on the following schema :

{"type": "record","name": "Users","fields": [
        {
        "name":"userArray",
        "type": {
                "type":"array",
                "items": {
                        "name":"User",
                        "type":"record",
                        "fields": [
                                {"name":"name","type":"string"},
                                {"name":"id","type":"long"}
                              ]
                     }
            }
        }
       ]}

*nextType* returns "record" at the beginning and always "array" after. I
would like to go deeper (and to access to "string" and "long")

*currentRecordName* returns every time "Users", it can not go deeper either.

*nextFieldName* returns "userArray" and not what's inside an array (here,
"User" - "name" and "id").

I would like to access to these values using avro functions. ("*User*" - "
*name*" - "*id*")

Could anyone can help me ?

Thanks

Reply via email to