You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "Robert Yokota (Jira)" <ji...@apache.org> on 2025/07/01 00:04:00 UTC

[jira] [Assigned] (AVRO-4161) C# decimal conversions are not correct

     [ https://issues.apache.org/jira/browse/AVRO-4161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Yokota reassigned AVRO-4161:
-----------------------------------


> C# decimal conversions are not correct
> --------------------------------------
>
>                 Key: AVRO-4161
>                 URL: https://issues.apache.org/jira/browse/AVRO-4161
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: csharp
>    Affects Versions: 1.12.0
>            Reporter: Robert Yokota
>            Assignee: Robert Yokota
>            Priority: Major
>
> The conversion from the C# System.Decimal to an Avro logical type decimal is not correct.  The first 12 bytes of the System.Decimal represent a positive unscaled value.  This value is passed into a BigInteger constructor.  However, the documentation of the [BigInteger constructor| https://learn.microsoft.com/en-us/dotnet/api/system.numerics.biginteger.-ctor?view=net-9.0#system-numerics-biginteger-ctor(system-byte())] states that the most significant bit of the last byte represents the sign of the BigInteger.  The docs also explain that a 0 byte can be appended to the byte array passed to the BigInteger constructor to ensure the value is treated as positive.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)