[ 
https://issues.apache.org/jira/browse/AVRO-3218?focusedWorklogId=660874&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-660874
 ]

ASF GitHub Bot logged work on AVRO-3218:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Oct/21 11:52
            Start Date: 06/Oct/21 11:52
    Worklog Time Spent: 10m 
      Work Description: vegraux opened a new pull request #1350:
URL: https://github.com/apache/avro/pull/1350


   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [x] My PR addresses the following 
[AVRO-3218](https://issues.apache.org/jira/browse/AVRO-3218) issue and 
references them in the PR title. For example, "AVRO-1234: My Avro PR"
     - https://issues.apache.org/jira/browse/AVRO-XXX
   
   ### Tests
   
   - [x] My PR adds to the following unit tests: 
[`lang/py/avro/test/test_schema.TestMisc.test_decimal_valid_type`](https://github.com/vegraux/avro/commit/4ad20199420a40846898462e52c1fe82ccbd84be#diff-d5bd2c903fbc9d00b21cd566f5af8da89bc757ecefbf6df2a3006b84492ae124R655):
   
   ### Commits
   
   - [x] My commits all reference Jira issues in their subject lines. In 
addition, my commits follow the guidelines from "[How to write a good git 
commit message](https://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [ ] In case of new functionality, my PR adds documentation that describes 
how to use it.
     - All the public functions and the classes in the PR contain Javadoc that 
explain what it does
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

            Worklog Id:     (was: 660874)
    Remaining Estimate: 0h
            Time Spent: 10m

> Pass LogicalType to BytesDecimalSchema in Python
> ------------------------------------------------
>
>                 Key: AVRO-3218
>                 URL: https://issues.apache.org/jira/browse/AVRO-3218
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 1.10.2
>         Environment: I am using  avro 1.10.2. Example file to reproduce the 
> problem. 
> [^issue.py]
>            Reporter: Vegard Solberg
>            Priority: Major
>         Attachments: issue.py
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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: 
> {code:java}
> { "name": "myField", "type": [ "null", { "type": "bytes", "logicalType": 
> "decimal", "precision": 12, "scale": 2 } ]}
> {code}
> Eventually, make_bytes_decimal_schema() is called. At this point, the 
> variable other_props looks like this (and is fine):
>  
> {code:java}
> other_props = {'logicalType': 'decimal', 'precision': 12, 'scale': 2}{code}
>  
> 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:
> {code:java}
> {"type": ["null", {"type": "bytes", "precision": 12, "scale": 2}], "name": 
> "myField"}
> {code}
>  
> The suggested fix is to simply pass other_props as an argument into 
> BytesDecimalSchema(). The attached file [^issue.py]contains code to reproduce 
> the bug
>  
> This commit contains the suggested changes: [AVRO-3218 Fix parsing of 
> logicalType = decimal · vegraux/avro@b5c4a78 
> (github.com)|https://github.com/vegraux/avro/commit/b5c4a78bc314bdecb6e1b7b32ba5d02ab8670c72]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to