[
https://issues.apache.org/jira/browse/AVRO-1278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13609304#comment-13609304
]
Carl Steinbach commented on AVRO-1278:
--------------------------------------
I observed the following behavior using Avro version 1.7.4:
{code}
% avropipe ComplexTypes.avro
Error opening ComplexTypes.avro:
Cannot parse file header: Error parsing JSON: \u0000 is not allowed near
'"\u0000"'
{code}
However, I can dump the header and contents of the same file using the Java
Avro library:
{code}
% avro getschema ComplexTypes.avro
{
"type" : "record",
"name" : "ComplexTypes",
"namespace" : "avro_fdw",
"fields" : [ {
"name" : "mapField",
"type" : {
"type" : "map",
"values" : "int"
},
"default" : {
}
}, {
"name" : "arrayField",
"type" : {
"type" : "array",
"items" : "int"
},
"default" : [ ]
}, {
"name" : "enumField",
"type" : {
"type" : "enum",
"name" : "RGBEnum",
"symbols" : [ "RED", "GREEN", "BLUE" ]
},
"default" : "RED"
}, {
"name" : "fixedField",
"type" : {
"type" : "fixed",
"name" : "MD5Fixed",
"size" : 16
},
"default" : "\u0000"
}, {
"name" : "unionField",
"type" : [ "string", "int", "float" ],
"default" : "DEFAULT VALUE"
}, {
"name" : "recordField",
"type" : {
"type" : "record",
"name" : "SampleRecord",
"fields" : [ {
"name" : "stringField",
"type" : "string",
"default" : "DEFAULT VALUE"
}, {
"name" : "intField",
"type" : "int",
"default" : 0
} ]
},
"default" : {
}
} ]
}
% avro tojson ComplexTypes.avro
{"mapField":{},"arrayField":[],"enumField":"RED",
"fixedField":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"unionField":{"string":"DEFAULT VALUE"},"recordField":{"stringField":"DEFAULT
VALUE","intField":0}}
{"mapField":{},"arrayField":[],"enumField":"RED",
"fixedField":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
"unionField":{"string":"DEFAULT VALUE"},"recordField":{"stringField":"DEFAULT
VALUE","intField":0}}
{"mapField":{"b":2,"c":3,"a":1},"arrayField":[-2,-1,0,1,2],"enumField":"GREEN",
"fixedField":"è\fq^]NÂ_hãÂ
;_Ãs","unionField":{"int":1},
"recordField":{"stringField":"SAMPLE VALUE","intField":100}}
{code}
The error is thrown in json_loadb() which gets called from
avro_schema_from_json_length().
> Avro-C: Error parsing schema with fixed field default value
> -----------------------------------------------------------
>
> Key: AVRO-1278
> URL: https://issues.apache.org/jira/browse/AVRO-1278
> Project: Avro
> Issue Type: Bug
> Components: c
> Affects Versions: 1.7.4
> Reporter: Carl Steinbach
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira