[jira] [Comment Edited] (AVRO-2363) avro.schema.Schema in py3 prevents same record type from being used multiple times in same schema

2019-04-01 Thread Gabriel Andersson (JIRA)


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

Gabriel Andersson edited comment on AVRO-2363 at 4/1/19 12:33 PM:
--

Pull request was closed.

The reason was that when importing the schemas in correct order there was no 
problem.

solved by doing this.
{code:java}
[
  {
"fields": [
  {
"name": "value",
"type":  "string"
  }
],
"name": "C",
"namespace": "namespace"
"type": "record"
  },
  {
"fields": [
  {
"name": "c",
"type": "namespace.C"
  }
],
"name": "B",
"namespace": "namespace",
"type": "record"
  },
  {
"doc": "",
"fields": [
  {
"name": "b",
"type": "namespace.B"
  },
  {
"name": "c",
"type": "namespace.C"
  }
],
"name": "A",
"namespace": "namespace",
"type": "record"
  }
]

{code}
 


was (Author: krabban91):
Pull request was closed.

The reason was that when importing the schemas in correct order there was no 
problem.

solved by doing this.
{code:java}
[
  {
"fields": [
  {
"name": "value",
"type":  "string"
  }
],
"name": "C",
"namespace": "namespace"
"type": "record"
  },
  {
"fields": [
  {
"name": "c",
"type": namespace.C
  }
],
"name": "B",
"namespace": "namespace",
"type": "record"
  },
  {
"doc": "",
"fields": [
  {
"name": "b",
"type": namespace.B
  },
  {
"name": "c",
"type": namespace.C
  }
],
"name": "A",
"namespace": "namespace",
"type": "record"
  }
]

{code}
 

> 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)


[jira] [Commented] (AVRO-2363) avro.schema.Schema in py3 prevents same record type from being used multiple times in same schema

2019-04-01 Thread Gabriel Andersson (JIRA)


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

Gabriel Andersson commented on AVRO-2363:
-

Pull request was closed.

The reason was that when importing the schemas in correct order there was no 
problem.

solved by doing this.
{code:java}
[
  {
"fields": [
  {
"name": "value",
"type":  "string"
  }
],
"name": "C",
"namespace": "namespace"
"type": "record"
  },
  {
"fields": [
  {
"name": "c",
"type": namespace.C
  }
],
"name": "B",
"namespace": "namespace",
"type": "record"
  },
  {
"doc": "",
"fields": [
  {
"name": "b",
"type": namespace.B
  },
  {
"name": "c",
"type": namespace.C
  }
],
"name": "A",
"namespace": "namespace",
"type": "record"
  }
]

{code}
 

> 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)


[jira] [Commented] (AVRO-2363) avro.schema.Schema in py3 prevents same record type from being used multiple times in same schema

2019-04-01 Thread Gabriel Andersson (JIRA)


[ 
https://issues.apache.org/jira/browse/AVRO-2363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)


[jira] [Created] (AVRO-2363) avro.schema.Schema in py3 prevents same record type from being used multiple times in same schema

2019-03-29 Thread Gabriel Andersson (JIRA)
Gabriel Andersson created AVRO-2363:
---

 Summary: 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


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)