You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Richard Ahrens (JIRA)" <ji...@apache.org> on 2010/11/08 22:48:22 UTC
[jira] Created: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
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
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (AVRO-694) Python protocol parsing failing on
maps with record value types defined within protocol
Posted by "Matt Massie (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931105#action_12931105 ]
Matt Massie commented on AVRO-694:
----------------------------------
I'd like to second that "thank you". I tripped on this bug last week myself and it's great to have a fix so quickly.
> 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.
[jira] Commented: (AVRO-694) Python protocol parsing failing on
maps with record value types defined within protocol
Posted by "Jeff Hammerbacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930890#action_12930890 ]
Jeff Hammerbacher commented on AVRO-694:
----------------------------------------
Thanks for catching this one, Richard. I attached a patch that fixes the issue for me and included your protocol as a unit test.
> 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.
[jira] Commented: (AVRO-694) Python protocol parsing failing on
maps with record value types defined within protocol
Posted by "Richard Ahrens (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12931018#action_12931018 ]
Richard Ahrens commented on AVRO-694:
-------------------------------------
Thanks for the quick fix, Jeff.
> 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.
[jira] Updated: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
Posted by "Jeff Hammerbacher (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Doug Cutting updated AVRO-694:
------------------------------
Fix Version/s: 1.5.0
Assignee: Jeff Hammerbacher
> 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
> Assignee: Jeff Hammerbacher
> Fix For: 1.5.0
>
> 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.
[jira] Updated: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
Posted by "Richard Ahrens (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Ahrens updated AVRO-694:
--------------------------------
Description:
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)
was: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.
> 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
>
>
> 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.
[jira] Updated: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Doug Cutting updated AVRO-694:
------------------------------
Status: Patch Available (was: Open)
Unless there are objections, I will commit this soon.
> 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
> Assignee: Jeff Hammerbacher
> Fix For: 1.5.0
>
> 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.
[jira] Commented: (AVRO-694) Python protocol parsing failing on
maps with record value types defined within protocol
Posted by "Jeff Hammerbacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930893#action_12930893 ]
Jeff Hammerbacher commented on AVRO-694:
----------------------------------------
Code review up at https://reviews.apache.org/r/81/
> 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.
[jira] Updated: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
Posted by "Richard Ahrens (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Ahrens updated AVRO-694:
--------------------------------
Attachment: API.avpr
> 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
>
>
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (AVRO-694) Python protocol parsing failing on maps
with record value types defined within protocol
Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/AVRO-694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Doug Cutting updated AVRO-694:
------------------------------
Resolution: Fixed
Status: Resolved (was: Patch Available)
I committed this. Thanks, Jeff!
> 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
> Assignee: Jeff Hammerbacher
> Fix For: 1.5.0
>
> 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.