Lstarsky0 commented on issue #10792: URL: https://github.com/apache/arrow-rs/issues/10792#issuecomment-5383985918
The arm is `cast/mod.rs:209-213` — `Utf8View | Utf8 | LargeUtf8` to any `Decimal*` is an unconditional `true`. The rejection is at `cast/decimal.rs:798`. The float path you're contrasting with does handle negative scale: `cast/mod.rs:375` branches on `scale < 0` and divides by `10^-scale`. The string path has no divide because `parse_decimal` has none, which is #10791. So the two ways to close this aren't equivalent — narrowing `can_cast_types` to `scale >= 0` restores the contract but leaves string to negative-scale decimal unsupported, whereas making the cast work means #10791 lands first. Probably worth settling which one is wanted before someone starts, since #10791 is already taken. The same arm also over-reports for `scale > MAX_SCALE`: ``` can_cast_types(Utf8, Decimal128(10, 40)) == true cast Utf8 -> Err "Cannot cast string to decimal greater than maximum scale 38" cast Float64 -> Err "scale 40 is greater than max 38" ``` That one has only a single resolution, since no source type supports it. Same arm, so whatever lands here should probably cover both. -- 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]
