You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Robert Yokota (Jira)" <ji...@apache.org> on 2025/07/01 00:04:00 UTC
[jira] [Created] (AVRO-4161) C# decimal conversions are not correct
Robert Yokota created AVRO-4161:
-----------------------------------
Summary: 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
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)