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

Christophe Le Saec edited comment on AVRO-3374 at 5/17/22 1:08 PM:
-------------------------------------------------------------------

Good question indeed.

[For first part of 
sentence|https://avro.apache.org/docs/current/spec.html#names] "Primitive type 
names have no namespace", it's OK as in example, "ns.int" define a record.

For second part  : "their names may not be defined in any namespace", it's not 
entirely clear to me. If it means that names of primitive may not be used to 
define other types as record; then the json shouldn't be parsed correctly in 
Java (and it should throw an exception). If it means that a new primitive type 
cannot be defined in a schema (said 'positive integer' for instance), the 
example is fine with it.


was (Author: JIRAUSER289541):
Good question indeed.

[For first part of 
sentence|https://avro.apache.org/docs/current/spec.html#names] "Primitive type 
names have no namespace", it's OK as in example, "ns.int" is a define a record.

For second part  : "their names may not be defined in any namespace", it's not 
entirely clear to me. If it means that names of primitive may not be used to 
define other types as record; then the json shouldn't be parsed correctly in 
Java (and it should throw an exception). If it means that a new primitive type 
cannot be defined in a schema (said 'positive integer' for instance), the 
example is fine with it.

> [Java] Fully qualified type reference "ns.int" loses namespace.
> ---------------------------------------------------------------
>
>                 Key: AVRO-3374
>                 URL: https://issues.apache.org/jira/browse/AVRO-3374
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.11.0
>            Reporter: Ryan Skraba
>            Assignee: Christophe Le Saec
>            Priority: Minor
>              Labels: pull-requests-available
>         Attachments: AVRO-3374.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> While brainstorming for AVRO-3370, I came across this special case where a 
> type-reference could be considered ambiguous if the SDK is not careful when 
> simplifying inherited namespaces:
> {code:json}
> {
>   "type" : "record",
>   "name" : "ns.int",
>   "fields" : [ 
>     {"name" : "value", "type" : "int"}, 
>     {"name" : "next", "type" : [ "null", "ns.int" ]}
>   ]
> }
> {code}
> In Java, if this code is parsed, it works as expected (as a linked list).
> If the schema is turned to a String using toString(), the namespace is 
> dropped off the last {*}{{ns.int}}{*}, turning it into the primitive. That 
> string can still be parsed into a Schema, but the "round-trip" modifies the 
> schema in an incompatible way.
> That namespace shouldn't be dropped when producing the JSON string 
> representing the Schema in Java.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to