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

John Dickson commented on AVRO-4026:
------------------------------------

I have raised two PRs, either of which resolve the exception the C++ library 
throws currently for non-string custom attributes.

PR 3064 keeps the current behavior for string custom attributes (returning the 
content of the string value). Non-string custom attributes are returned as a 
string of JSON text. This creates ambiguity as in some cases the value could be 
interpreted as either i.e. the value "true" could be a string or it could be 
the boolean value. A schema parsed this way may not be possible to preserve the 
original structure when written back out.

PR 3069 does not have the ambiguity and can preserve the original structure, at 
the expense of changing the current behavior. The custom attribute value is 
always returned as JSON text, which means string values will be quoted. This is 
in keeping with the comments in issue AVRO-3601.

My preference is PR 3069 if anyone cares.

> Schemas with non-string custom attributes fail to compile
> ---------------------------------------------------------
>
>                 Key: AVRO-4026
>                 URL: https://issues.apache.org/jira/browse/AVRO-4026
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: c++
>    Affects Versions: 1.11.2, 1.11.3
>            Reporter: John Dickson
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> AVRO-3601 fixed the install issue, but any schema with non-string custom 
> attributes now fails to compile with an exception.
> For example the following schema that cannot be compiled in 1.11.2, while it 
> worked in earlier versions:
> {code}
> {
>   "type": "record",
>   "name": "Test",
>   "fields": [ {
>     "name": "f1",
>     "type": "string",
>     "extra": {
>       "custom1": "value",
>       "custom2": true
>     }
>   } ]
> }
> {code}



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

Reply via email to