Mark1626 commented on code in PR #18999:
URL: https://github.com/apache/datafusion/pull/18999#discussion_r2623589630
##########
datafusion/functions/src/utils.rs:
##########
@@ -219,6 +221,52 @@ pub fn decimal128_to_i128(value: i128, scale: i8) ->
Result<i128, ArrowError> {
}
}
+pub fn decimal32_to_i32(value: i32, precision: u8, scale: i8) -> Result<i32,
ArrowError> {
+ if scale < 0 {
+ Err(ArrowError::ComputeError(
+ "Negative scale is not supported".into(),
+ ))
+ } else if scale as u8 > precision {
+ Err(ArrowError::ComputeError(format!(
+ "scale {scale} is greater than precision {precision}"
+ )))
+ } else if scale == 0 {
+ Ok(value)
+ } else {
+ validate_decimal32_precision(value, precision, scale)?;
Review Comment:
Sure, I'll remove these redundant checks
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]