[ 
https://issues.apache.org/jira/browse/AVRO-3992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17863609#comment-17863609
 ] 

ASF subversion and git services commented on AVRO-3992:
-------------------------------------------------------

Commit 49587555fa79214bdee8929ee9cdf1c4d3e183f6 in avro's branch 
refs/heads/dependabot/maven/lang/java/org.apache.hadoop-hadoop-client-3.4.0 
from Gerrit Birkeland
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=49587555f ]

AVRO-3992 [C++] Fix compiler warnings in code generated by schema with empty 
record (#2927)

* [C++] Fix compiler warnings in code generated by schema with empty record

* [C++] Generate union names for record array-unions

Added to make writing a test for empty unions easier.

* [C++] Fix validatingEncoder for records

> [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