[ https://issues.apache.org/jira/browse/AVRO-4117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thiruvalluvan M. G. resolved AVRO-4117. --------------------------------------- Fix Version/s: 1.13.0 Resolution: Fixed Thank you [~mmalhotra] > avrocpp throws an exception if unreserved key in schema has a non string value > ------------------------------------------------------------------------------ > > Key: AVRO-4117 > URL: https://issues.apache.org/jira/browse/AVRO-4117 > Project: Apache Avro > Issue Type: Bug > Components: c++ > Affects Versions: 1.11.4 > Environment: Linux > c++17 > Reporter: Manik Malhotra > Assignee: Manik Malhotra > Priority: Minor > Labels: pull-request-available > Fix For: 1.13.0 > > Time Spent: 1h 20m > Remaining Estimate: 0h > > Steps to reproduce: > 1. Create cpx.json schema file: > {code:java} > { > "fields": [ > { > "type": [ > { > "minItems": 1, > "type": "array", > "items": "string" > } > ], > "name": "bug" > } > ], > "type": "record", > "name": "cpx" > } {code} > 2. Create bug.cpp file > {code:java} > #include <fstream> > #include <avro/ValidSchema.hh> > #include <avro/Schema.hh> > #include <avro/Compiler.hh>int main(int argc, char* argv[]) > { > if (argc < 2) { > std::cerr << "Usage: " << argv[0] << " <schema json>" << std::endl; > return 1; > } std::string schema_file = argv[1]; > std::ifstream ins(schema_file); > avro::ValidSchema cpxSchema; > avro::compileJsonSchema(ins, cpxSchema); > } {code} > 3. compile and run the cpp file with schema file as argument: > {code:java} > g++ -std=c++17 bug.cpp -o bug -I/usr/local/include -L/usr/local/lib -lavrocpp > ./bug cpx.json{code} > expected behavior: 0 return code > observed behavior: 134 return code with output: > {code:java} > terminate called after throwing an instance of 'avro::Exception' > what(): Invalid type. Expected "string" actual long > Aborted {code} > > > The same schema works in c, python, and java implementations as they don't > require such keys to be string. -- This message was sent by Atlassian Jira (v8.20.10#820010)