You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/11 17:00:57 UTC

[GitHub] [arrow-rs] viirya commented on a change in pull request #1151: Add add_scalar kernel

viirya commented on a change in pull request #1151:
URL: https://github.com/apache/arrow-rs/pull/1151#discussion_r782352643



##########
File path: arrow/src/compute/kernels/arithmetic.rs
##########
@@ -1010,6 +1073,28 @@ where
     return math_op(left, right, |a, b| a + b);
 }
 
+/// Add every value in an array by a scalar. If any value in the array is null then the
+/// result is also null.
+pub fn add_scalar<T>(
+    array: &PrimitiveArray<T>,
+    scalar: T::Native,
+) -> Result<PrimitiveArray<T>>
+where
+    T: datatypes::ArrowNumericType,
+    T::Native: Add<Output = T::Native>
+        + Sub<Output = T::Native>
+        + Mul<Output = T::Native>
+        + Div<Output = T::Native>
+        + Rem<Output = T::Native>
+        + Zero
+        + One,
+{
+    #[cfg(feature = "simd")]
+    return simd_add_scalar(&array, scalar);

Review comment:
       Sounds good. Didn't find `simd_float_unary_math_op` there. Seems okay. Let me update.




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org