[ 
https://issues.apache.org/jira/browse/AVRO-3992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Tzvetanov Grigorov resolved AVRO-3992.
---------------------------------------------
    Fix Version/s: 1.12.0
         Assignee: Gerrit Birkeland
       Resolution: Fixed

> [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
>            Assignee: Gerrit Birkeland
>            Priority: Major
>             Fix For: 1.12.0
>
>
> I have an Avro schema resembling the following:
> {code:java}
> {
>   "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:java}
> 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:java}
> 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.
> Fix available at [https://github.com/apache/avro/pull/2927] - bot didn't pick 
> it up since the PR was first



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to