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


##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -47,28 +47,46 @@ use datafusion_expr::ColumnarValue;
 /// TODO: add switch codeGen in In_List
 static OPTIMIZER_INSET_THRESHOLD: usize = 30;
 
-macro_rules! compare_op_scalar {
-    ($left: expr, $right:expr, $op:expr) => {{
-        let null_bit_buffer = $left.data().null_buffer().cloned();
-
-        let comparison =
-            (0..$left.len()).map(|i| unsafe { $op($left.value_unchecked(i), 
$right) });
-        // same as $left.len()
-        let buffer = unsafe { 
MutableBuffer::from_trusted_len_iter_bool(comparison) };
-
-        let data = unsafe {
-            ArrayData::new_unchecked(
-                DataType::Boolean,
-                $left.len(),
-                None,
-                null_bit_buffer,
-                0,
-                vec![Buffer::from(buffer)],
-                vec![],
-            )
-        };
-        Ok(BooleanArray::from(data))
-    }};
+/// Applies an unary and infallible comparison function to a primitive
+/// array.  This is the fastest way to perform an operation on a
+/// primitive array when the benefits of a vectorized operation
+/// outweights the cost of branching nulls and non-nulls.
+///
+/// # Implementation
+///
+/// This will apply the function for all values, including those on
+/// null slots.  This implies that the operation must be infallible
+/// for any value of the corresponding type or this function may
+/// panic.
+///
+/// # Example
+/// TODO
+fn unary_cmp<I, F>(array: &PrimitiveArray<I>, op: F) -> BooleanArray

Review Comment:
   This is copy/paste from 
https://docs.rs/arrow/17.0.0/arrow/compute/kernels/arity/index.html
   
   



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

Reply via email to