jonahgao commented on code in PR #7904:
URL: https://github.com/apache/arrow-datafusion/pull/7904#discussion_r1368221509


##########
datafusion/physical-expr/src/math_expressions.rs:
##########
@@ -701,6 +701,29 @@ macro_rules! make_try_abs_function {
     }};
 }
 
+// Decimal types should keep the same precision and scale by using 
`with_data_type()`.
+// https://github.com/apache/arrow-rs/issues/4644
+macro_rules! make_decimal_abs_function {
+    ($ARRAY_TYPE:ident) => {{
+        |args: &[ArrayRef]| {
+            let array = downcast_arg!(&args[0], "abs arg", $ARRAY_TYPE);
+            let res: $ARRAY_TYPE = array
+                .try_unary(|x| {
+                    // Valid Decimal values should never overflow
+                    x.checked_abs().ok_or_else(|| {

Review Comment:
    Thank you @viirya, it makes sense to me.



-- 
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