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)