Jefffrey commented on code in PR #9207:
URL: https://github.com/apache/arrow-rs/pull/9207#discussion_r2700685049
##########
arrow-cast/src/cast/decimal.rs:
##########
@@ -831,11 +831,12 @@ where
if array.is_null(i) {
value_builder.append_null();
} else {
- let v = array
- .value(i)
- .div_checked(div)
- .ok()
- .and_then(<T::Native as NumCast>::from::<D::Native>);
+ let v = if scale < 0 {
Review Comment:
Could we pull this check outside the hot loop?
##########
arrow-cast/src/cast/mod.rs:
##########
@@ -3886,6 +3886,25 @@ mod tests {
);
}
+ #[test]
+ fn test_cast_decimal_to_numeric_negative_scale() {
Review Comment:
Can we add some more tests with different scales (e.g. that cause overflow
with and without safe casting) and other decimal types
--
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]