aweltsch commented on code in PR #7021:
URL: https://github.com/apache/arrow-rs/pull/7021#discussion_r1950263671
##########
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:
Well TBH, this mostly a safeguard for what I mentioned here:
https://github.com/apache/arrow-rs/pull/7021#discussion_r1948018718
In the previous version of the code any problem with scale or precision was
caught in the kernel via `validate_decimal_precision` /
`is_valid_decimal_precision`.
For the newly added code this is not the case anymore, but there could be a
problem if the output_precision exceeds the maximum allowed precision of the
type.
To not change the existing behavior too much, I'll probably only check this
inside the `is_infallible_cast` branch. I guess I will need to add some
handling for the `is_safe` parameter there too.
This would not be needed if we can make sure that at this point the
`output_precision` is always valid for the type. I investigated that, but I'm
not 100% convinced of that. Maybe you have some opinions 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]