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/04/05 19:48:27 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2107: Minor: Reduce repetition in Decimal binary kernels

alamb commented on code in PR #2107:
URL: https://github.com/apache/arrow-datafusion/pull/2107#discussion_r843201343


##########
datafusion-physical-expr/src/expressions/binary.rs:
##########
@@ -135,260 +135,192 @@ fn is_not_distinct_from_bool(
 // TODO move decimal kernels to to arrow-rs
 // https://github.com/apache/arrow-rs/issues/1200
 
-// TODO use iter added for for decimal array in
-// https://github.com/apache/arrow-rs/issues/1083
+/// Creates an BooleanArray the same size as `left`,
+/// applying `op` to all non-null elements of left
+fn compare_decimal_scalar<F>(
+    left: &DecimalArray,
+    right: i128,
+    op: F,
+) -> Result<BooleanArray>
+where
+    F: Fn(i128, i128) -> bool,
+{
+    Ok(left
+        .iter()
+        .map(|left| left.map(|left| op(left, right)))

Review Comment:
   I think the call to `collect()` eventually needs the iterator to be sized (so it knows how large an array to allocate)



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