You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Gabriel Andersson (JIRA)" <ji...@apache.org> on 2019/04/01 10:28:04 UTC
[jira] [Commented] (AVRO-2363) avro.schema.Schema in py3 prevents
same record type from being used multiple times in same schema
[ https://issues.apache.org/jira/browse/AVRO-2363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16806625#comment-16806625 ]
Gabriel Andersson commented on AVRO-2363:
-----------------------------------------
Pull request created:
https://github.com/apache/avro/pull/499
> avro.schema.Schema in py3 prevents same record type from being used multiple times in same schema
> -------------------------------------------------------------------------------------------------
>
> Key: AVRO-2363
> URL: https://issues.apache.org/jira/browse/AVRO-2363
> Project: Apache Avro
> Issue Type: Bug
> Components: python
> Affects Versions: 1.9.0
> Reporter: Gabriel Andersson
> Priority: Major
>
> After mostly worked in Java with avro, schemas have been used in an hierachial way. I.e. Schema A imports Schema B and Schema C, Schema B imports schema C.
>
> This works in a confluent setting. But when loading the schema, the application crashes due to reusing record types.
> The following relaxes this relation.
> avro.schema.py
>
> {code:java}
> diff --git a/lang/py3/avro/schema.py b/lang/py3/avro/schema.py
> index 7ce29731..63af3581 100644
> --- a/lang/py3/avro/schema.py
> +++ b/lang/py3/avro/schema.py
> @@ -397,9 +397,6 @@ class Names(object):
> if schema.fullname in VALID_TYPES:
> raise SchemaParseException(
> '%s is a reserved type name.' % schema.fullname)
> - if schema.fullname in self.names:
> - raise SchemaParseException(
> - 'Avro name %r already exists.' % schema.fullname)
>
> logger.log(DEBUG_VERBOSE, 'Register new name for %r', schema.fullname)
> self._names[schema.fullname] = schema
> {code}
>
>
> Example schema:
> {code:java}
> {
> "doc": "",
> "fields": [
> {
> "default": null,
> "doc": "Optional. The context used for tracing of flow.",
> "name": "b",
> "type": [
> "null",
> {
> "doc": "",
> "fields": [
> {
> "doc": "",
> "name": "c",
> "type": {
> "doc": "",
> "fields": [
> {
> "doc": "",
> "name": "value",
> "type": "string"
>
> }
> ],
> "name": "C",
> "type": "record"
> }
> }
> ],
> "name": "B",
> "type": "record"
> }
> ]
> },
> {
> "doc": "",
> "name": "c",
> "type": {
> "doc": "",
> "fields": [
> {
> "doc": "",
> "name": "value",
> "type": "string"
> }
> ],
> "name": "C",
> "type": "record"
> }
> }
> ],
> "name": "A",
> "namespace": "namespace",
> "type": "record"
> }
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)