Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.10.2
-
I am using avro 1.10.2. Example file to reproduce the problem.
issue.py
Description
I get an error when parsing a schema which contains a field with `logicalType=decimal` in Python. Spesifically, I am using avro.schema.parse() on a schema which have a field on the following format:
{ "name": "myField", "type": [ "null", { "type": "bytes", "logicalType": "decimal", "precision": 12, "scale": 2 } ]}
Eventually, make_bytes_decimal_schema() is called. At this point, the variable other_props looks like this (and is fine):
other_props = {'logicalType': 'decimal', 'precision': 12, 'scale': 2}
Unlike the other logical types, the variable other_props is not passed on to BytesDecimalSchema. The result is that the resulting logical_schema is missing the key-value pair 'logicalType': 'decimal'. This blocks me from writing to a kafka topic, because the schema is parsed incorrectly. The resulting field looks like this:
{"type": ["null", {"type": "bytes", "precision": 12, "scale": 2}], "name": "myField"}
The suggested fix is to simply pass other_props as an argument into BytesDecimalSchema(). The attached file issue.pycontains code to reproduce the bug
This commit contains the suggested changes: AVRO-3218 Fix parsing of logicalType = decimal · vegraux/avro@b5c4a78 (github.com)
Attachments
Attachments
Issue Links
- links to