aweltsch commented on code in PR #7021:
URL: https://github.com/apache/arrow-rs/pull/7021#discussion_r1952088694


##########
arrow-cast/src/cast/decimal.rs:
##########
@@ -99,10 +100,24 @@ where
     I::Native: DecimalCast + ArrowNativeTypeOp,
     O::Native: DecimalCast + ArrowNativeTypeOp,
 {
+    validate_decimal_precision_and_scale::<O>(output_precision, output_scale)?;

Review Comment:
   I have just realized that there is a precision check at the _bottom_ of the 
decimal casting functions 
([here](https://github.com/apache/arrow-rs/blob/27d2a7510d75163f1d8cb430666662f3bef8bbea/arrow-cast/src/cast/decimal.rs#L198)
 and 
[here](https://github.com/apache/arrow-rs/blob/27d2a7510d75163f1d8cb430666662f3bef8bbea/arrow-cast/src/cast/decimal.rs#L236),
 via 
[this](https://github.com/apache/arrow-rs/blob/27d2a7510d75163f1d8cb430666662f3bef8bbea/arrow-array/src/array/primitive_array.rs#L1542)).
 My suggestion would be to remove `pub(crate)` from 
`convert_to_smaller_scale_decimal` or 
`convert_to_bigger_or_equal_scale_decimal`, add another test case for invalid 
`output_precision` for the conversion functions and _not_ add an additional 
layer of validations on top.
   @parthchandra since you originally raised the concern about the validation, 
do you have an opinion on that?



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to