You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/06/16 18:32:00 UTC

[jira] [Work logged] (AVRO-3521) "Scale" property from decimal object

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

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

                Author: ASF GitHub Bot
            Created on: 16/Jun/22 18:31
            Start Date: 16/Jun/22 18:31
    Worklog Time Spent: 10m 
      Work Description: RyanSkraba commented on code in PR #1689:
URL: https://github.com/apache/avro/pull/1689#discussion_r899406407


##########
lang/py/avro/io.py:
##########
@@ -699,7 +699,7 @@ def read_data(self, writers_schema: avro.schema.Schema, readers_schema: avro.sch
                     warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal precision {precision}. Must be a positive integer."))
                     return decoder.read_bytes()
                 scale = writers_schema.get_prop("scale")
-                if not (isinstance(scale, int) and scale > 0):
+                if not (isinstance(scale, int) and scale >= 0):
                     warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal scale {scale}. Must be a positive integer."))

Review Comment:
   ```suggestion
                       warnings.warn(avro.errors.IgnoredLogicalType(f"Invalid decimal scale {scale}. Must be a non-negative integer."))
   ```





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

    Worklog Id:     (was: 782143)
    Time Spent: 20m  (was: 10m)

> "Scale" property from decimal object
> ------------------------------------
>
>                 Key: AVRO-3521
>                 URL: https://issues.apache.org/jira/browse/AVRO-3521
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: python
>    Affects Versions: 1.10.2
>            Reporter: Igor Izvekov
>            Assignee: Igor Izvekov
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.1
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> From [https://avro.apache.org/docs/current/spec.html:]
>     - scale, a JSON integer representing the scale (optional). If not specified the scale is 0.
> In the "datafile.py" scale greater than or *equal* to 0, but "DatumReader" and "DatumWriter" reads/writes values greater than 0 (not equal 0).



--
This message was sent by Atlassian Jira
(v8.20.7#820007)