wleeaf commented on PR #717:
URL: https://github.com/apache/avro-rs/pull/717#issuecomment-6402590431
Good point, thanks. Resolving now checks the number of decimal digits of the
unscaled value against the precision, so a value with more digits than the
precision is rejected again, and shorter values still pass (589b0b7). The new
test covers 12345 with precision 4 (rejected) and 5 (accepted), and -99999
(accepted) and -100000 (rejected) with precision 5, for both `Decimal` and
`Bytes` values.
Two existing tests changed with it:
`resolve_decimal_invalid_precision_for_length` now expects an error for its
18-digit value with precision 1, which its name suggests was the intent, and
`avro_rs_342_decimal_fixed_and_bytes` uses a 17-digit value instead of 22
digits for `decimal(20, 0)`.
The rejection reuses `ComparePrecisionAndSize`, whose message still talks
about bytes ("Precision 4 too small to hold decimal values with 2 bytes"). If
you'd prefer, I can add a separate variant that reports the digit count instead.
--
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]