From 6230435b4fd8ccad9151e766bbc3abb5009cce06 Mon Sep 17 00:00:00 2001 From: Zhao Gang Date: Mon, 1 Jul 2024 18:04:03 +0800 Subject: [PATCH] Add operation in ArrowNativeTypeOp::neg_check error message (#5944) (#5980) --- arrow-arith/src/numeric.rs | 8 ++++---- arrow-array/src/arithmetic.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arrow-arith/src/numeric.rs b/arrow-arith/src/numeric.rs index 17b794762b9..91aaf628438 100644 --- a/arrow-arith/src/numeric.rs +++ b/arrow-arith/src/numeric.rs @@ -888,15 +888,15 @@ mod tests { test_neg_primitive::( &[i32::MIN], - Err("Compute error: Overflow happened on: -2147483648"), + Err("Compute error: Overflow happened on: - -2147483648"), ); test_neg_primitive::( &[i64::MIN], - Err("Compute error: Overflow happened on: -9223372036854775808"), + Err("Compute error: Overflow happened on: - -9223372036854775808"), ); test_neg_primitive::( &[i64::MIN], - Err("Compute error: Overflow happened on: -9223372036854775808"), + Err("Compute error: Overflow happened on: - -9223372036854775808"), ); let r = neg_wrapping(&Int32Array::from(vec![i32::MIN])).unwrap(); @@ -911,7 +911,7 @@ mod tests { assert_eq!( err, - "Compute error: Overflow happened on: -9223372036854775808" + "Compute error: Overflow happened on: - -9223372036854775808" ); let a = Decimal128Array::from(vec![1, 3, -44, 2, 4]) diff --git a/arrow-array/src/arithmetic.rs b/arrow-array/src/arithmetic.rs index 72989ad7d5e..078c2e3bc40 100644 --- a/arrow-array/src/arithmetic.rs +++ b/arrow-array/src/arithmetic.rs @@ -237,7 +237,7 @@ macro_rules! native_type_op { #[inline] fn neg_checked(self) -> Result { self.checked_neg().ok_or_else(|| { - ArrowError::ComputeError(format!("Overflow happened on: {:?}", self)) + ArrowError::ComputeError(format!("Overflow happened on: - {:?}", self)) }) }