[
https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jeff Hammerbacher updated AVRO-694:
-----------------------------------
Attachment: AVRO-694.patch
Missing "None" for namespace in the get_name call in MapSchema.
> Python protocol parsing failing on maps with record value types defined
> within protocol
> ---------------------------------------------------------------------------------------
>
> Key: AVRO-694
> URL: https://issues.apache.org/jira/browse/AVRO-694
> Project: Avro
> Issue Type: Bug
> Components: python
> Affects Versions: 1.4.1
> Environment: Avro Python library
> Reporter: Richard Ahrens
> Attachments: API.avpr, AVRO-694.patch
>
>
> The attached protocol defines a record named Symbol, and another record
> called MultiSymbol which includes a field of type map with value type Symbol.
> Parsing this protocol from python generates an exception when parsing,
> although it parses fine from Java. The protocol parses successfully in
> python if the map value is changed to a primitive such as string.
> Steps to reproduce:
> >>> import avro.ipc as ipc
> >>> import avro.protocol as protocol
> >>> p = protocol.parse(open("API.avpr").read())
> Traceback (most recent call last):
> File "<pyshell#28>", line 1, in <module>
> p = protocol.parse(open("C:\\Documents and
> Settings\\nbkpw2e\\Desktop\\API.avpr").read())
> File "C:\rla\dev\Python27\lib\site-packages\avro\protocol.py", line 221, in
> parse
> return make_avpr_object(json_data)
> File "C:\rla\dev\Python27\lib\site-packages\avro\protocol.py", line 209, in
> make_avpr_object
> return Protocol(name, namespace, types, messages)
> File "C:\rla\dev\Python27\lib\site-packages\avro\protocol.py", line 100, in
> __init__
> self.set_prop('types', self._parse_types(types, type_names))
> File "C:\rla\dev\Python27\lib\site-packages\avro\protocol.py", line 52, in
> _parse_types
> type_object = schema.make_avsc_object(type, type_names)
> File "C:\rla\dev\Python27\lib\site-packages\avro\schema.py", line 664, in
> make_avsc_object
> return RecordSchema(name, namespace, fields, names, type)
> File "C:\rla\dev\Python27\lib\site-packages\avro\schema.py", line 600, in
> __init__
> field_objects = RecordSchema.make_field_objects(fields, names)
> File "C:\rla\dev\Python27\lib\site-packages\avro\schema.py", line 568, in
> make_field_objects
> new_field = Field(type, name, has_default, default, order, names)
> File "C:\rla\dev\Python27\lib\site-packages\avro\schema.py", line 310, in
> __init__
> raise SchemaParseException(fail_msg)
> SchemaParseException: Type property "{'values': 'xyz.api.product.Symbol',
> 'type': 'map'}" not a valid Avro schema: get_name() takes exactly 3 arguments
> (2 given)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.