[
https://issues.apache.org/jira/browse/AVRO-1352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13863902#comment-13863902
]
Steve Roehrs commented on AVRO-1352:
------------------------------------
That will teach me for not previewing! Try this :
{noformat}
void
NodeFixed::PrintJson(std::ostream &os, int depth) const
{
os << "{\n";
os << indent(++depth) << "\"type\": \"fixed\",\n";
printName(os, nameAttribute_.get(),depth);
os << indent(depth) << "\"size\": << sizeAttribute_.get() << "\n";
os << indent(--depth) << '}';
}
{noformat}
> Schema for fixed types corrupted when writing out in JSON format
> ----------------------------------------------------------------
>
> Key: AVRO-1352
> URL: https://issues.apache.org/jira/browse/AVRO-1352
> Project: Avro
> Issue Type: Bug
> Components: c++
> Affects Versions: 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4
> Reporter: Steve Roehrs
> Priority: Minor
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> A change made in NodeImpl.cc under AVRO-1026 has introduced a bug that
> corrupts JSON schemas when writing them to disk or dumping to a stream. This
> manifested when using DataFileWriter to generate a data file, and the schema
> stored in the header was corrupted from the original schema provided.
>
> e.g
>
> This:
> {noformat}
> {
> “type”: “fixed”,
> “name”: “Unsigned16”,
> “size”: 2
> }
> {noformat}
>
> Becomes this:
> {noformat}
> {
> “type”: “fixed”,
> “size”: 2,
> “name” : “Unsigned16”,
> }
> {noformat}
> Note the extraneous comma after the ‘name’ attribute.
> The bug exists for Avro 'fixed' types, and has not been observed for other
> types. A test case will be developed.
> The bug can be fixed by simply re-ordering the code in NodeFixed::printJson.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)