You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/02/07 15:22:00 UTC
[jira] [Work logged] (AVRO-3370) [Spec] Inconsistent behaviour on types as invalid names.
[ https://issues.apache.org/jira/browse/AVRO-3370?focusedWorklogId=721979&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-721979 ]
ASF GitHub Bot logged work on AVRO-3370:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Feb/22 15:21
Start Date: 07/Feb/22 15:21
Worklog Time Spent: 10m
Work Description: martin-g opened a new pull request #1525:
URL: https://github.com/apache/avro/pull/1525
Support references to types named after Avro complex types (record, enum
& fixed)
### Jira
- [X] My PR addresses the following [Avro Jira](https://issues.apache.org/jira/browse/AVRO/) issues and references them in the PR title. For example, "AVRO-1234: My Avro PR"
- https://issues.apache.org/jira/browse/AVRO-3370
-
### Tests
- [X] My PR adds the new unit tests
### Commits
- [X] My commits all reference Jira issues in their subject lines.
### Documentation
- [X] No need of new documentation in the Rust module. The spec might be updated if the behavior is approved
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@avro.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Issue Time Tracking
-------------------
Worklog Id: (was: 721979)
Remaining Estimate: 0h
Time Spent: 10m
> [Spec] Inconsistent behaviour on types as invalid names.
> --------------------------------------------------------
>
> Key: AVRO-3370
> URL: https://issues.apache.org/jira/browse/AVRO-3370
> Project: Apache Avro
> Issue Type: Bug
> Reporter: Ryan Skraba
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> We've run across this in some code that interoperates between Java and Python.
> The spec [currently forbids|https://avro.apache.org/docs/current/spec.html#names] using a primitive type name as a keyword: _*Primitive type names have no namespace and their names may not be defined in any namespace.*_
> {code:java}
> {"type":"record","name":"long","fields":[{"name":"a1","type":"long"}]} {code}
> That fails in Java with {{"org.apache.avro.AvroTypeException: Schemas may not be named after primitives: long"}}
> What do we expect to happen when a named schema uses a complex type?
> {code:java}
> {"type":"record","name":"record","fields":[{"name":"a1","type":"long"}]} {code}
> This currently *succeeds* in Java and the schema can be used to serialize and deserialize data.
> This currently *fails* in Python with: {{avro.schema.SchemaParseException: record is a reserved type name}}
> Which one is the correct behaviour?
> This gets a bit more complicated when we consider using the name as a reference.
> The following two schemas both work in Java:
> {code:java}
> {"type":"record","name":"LinkedList",
> "fields":[
> {"name":"value","type":"int},
> {"name":"next","type":["null","LinkedList"]}]}" {code}
> {code:java}
> {"type":"record","name":"LinkedList",
> "fields":[
> {"name":"value","type":"int},
> {"name":"next","type":["null",{"type":"LinkedList"}]}]}"
> {code}
> If we rename {{LinkedList}} to {{record}} the former succeeds in Java and the latter fails with {{{}org.apache.avro.SchemaParseException: No name in schema: {"type":"record"{}}}}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)