PyRSA commented on PR #8718: URL: https://github.com/apache/paimon/pull/8718#issuecomment-5078471725
> There are still issues with high-precision serialization of `Decimal`. `to_unscaled_bytes` and `from_unscaled_bytes` perform `scaleb` with the default `Decimal` precision of 28, causing valid `DECIMAL(38, s)` values to be silently rounded. For example, `12345678901234567890123456789012345678` is encoded as `12345678901234567890123456790000000000`. The shortest two’s complement representation of negative numbers is also incompatible with Java: `-128` outputs `ff80`, whereas `BigInteger.toByteArray()` should return `80`. Thanks for the review! Fixed the high-precision serialization issue by avoiding context-dependent scaleb operations during unscaled byte `encoding/decoding`, and aligned the signed byte representation with Java `BigInteger.toByteArray()`. Also added regression tests covering high-precision round-trip serialization and Java-compatible byte encoding. -- 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]
