Manik Malhotra created AVRO-4117: ------------------------------------ Summary: 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 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} -- This message was sent by Atlassian Jira (v8.20.10#820010)