tustvold commented on issue #1779: URL: https://github.com/apache/arrow-rs/issues/1779#issuecomment-1146072835
> The spec is Thank you for the link, that is very unfortunately worded but explains where this confusion has originated from. My interpretation of those comments would be that the represented values would have `precision` digits, with the decimal point located somewhere in that range. This also was the interpretation initially taken on https://github.com/apache/arrow-datafusion/pull/2680, and appears also to at least initially have been the interpretation of the decimal implementation in arrow-rs. If one takes the python and C++ implementations as correct, what the docs appear are actually saying is that the mantissa has `precision` digits, and `scale` is the exponent, but then talks about digits past a decimal point, which is somewhat inconsistent.... To highlight the distinction, consider the number `1000` or `0.0001`. Do these have 4 digits or 1 digit? If they have 1 digit, how many digits does they have past the decimal point? Ultimately I think there are at least these concrete issues that should be fixed: * The scale field within DataType::Decimal should be signed * The documentation should refer to scale as an exponent, and not potentially misleading notions of decimal points and digits * `DecimalArray::value` shouldn't be applying the scale to the value at all * We should probably audit the other places that interpret decimal values for consistency -- 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]
