You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/22 09:23:35 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3152: Support decimal negative scale

tustvold commented on code in PR #3152:
URL: https://github.com/apache/arrow-rs/pull/3152#discussion_r1029064164


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -1039,7 +1039,14 @@ impl<T: DecimalType + ArrowPrimitiveType> PrimitiveArray<T> {
                 Decimal128Type::MAX_SCALE
             )));
         }
-        if scale > precision {
+        if scale < -T::MAX_SCALE {

Review Comment:
   I wasn't sure about this, as the rationale for enforcing the upper limit is if the positive scale exceeds the precision it would result in truncation. I'm not sure this applies to the negative direction. However, the C++ version has this same check, so :shrug:  - https://github.com/apache/arrow/blob/91ee6dad722ee154d63eea86ce5644e1e658b53b/cpp/src/arrow/util/decimal.cc#L389
   
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org