Gerrit Birkeland created AVRO-3992: -------------------------------------- Summary: [C++] Encoding a record with 0 fields in a vector throws Key: AVRO-3992 URL: https://issues.apache.org/jira/browse/AVRO-3992 Project: Apache Avro Issue Type: Improvement Components: c++ Affects Versions: 1.11.3 Reporter: Gerrit Birkeland
I have an Avro schema resembling the following: {code} { "type": "record", "name": "StackCalculator", "fields": [ { "name": "stack", "type": { "type": "array", "items": [ "int", { "type": "record", "name": "Dup", "fields": [] }, { "type": "record", "name": "Add", "fields": [] } ] } } ] } {code} If I create one of these records with the stack: {code} uer::StackCalculator calc; uer::StackCalculator::stack_item_t item; item.set_int(3); calc.stack.push_back(item); item.set_Dup(uer::Dup()); calc.stack.push_back(item); item.set_Add(uer::Add()); calc.stack.push_back(item); {code} and try to encode this {code} ValidSchema s; ifstream ifs("jsonschemas/union_empty_record"); compileJsonSchema(ifs, s); unique_ptr<OutputStream> os = memoryOutputStream(); EncoderPtr e = validatingEncoder(s, jsonPrettyEncoder()); e->init(*os); avro::encode(*e, calc); {code} Avro throws {{startItem at not an item boundary}}. If the records without fields are given a dummy field, this works. -- This message was sent by Atlassian Jira (v8.20.10#820010)