comphead commented on code in PR #7726:
URL: https://github.com/apache/datafusion-comet/pull/7726#discussion_r4762660172


##########
native/spark-expr/src/math_funcs/modulo_expr.rs:
##########
@@ -88,20 +88,12 @@ fn checked_float_modulo(
     rhs: &ColumnarValue,
     data_type: &DataType,
 ) -> Result<ColumnarValue> {
-    let (left, right): (ArrayRef, ArrayRef) = match (lhs, rhs) {
-        (ColumnarValue::Array(l), ColumnarValue::Array(r)) => (Arc::clone(l), 
Arc::clone(r)),
-        (ColumnarValue::Scalar(l), ColumnarValue::Array(r)) => {
-            (l.to_array_of_size(r.len())?, Arc::clone(r))
-        }
-        (ColumnarValue::Array(l), ColumnarValue::Scalar(r)) => {
-            (Arc::clone(l), r.to_array_of_size(l.len())?)
-        }
-        (ColumnarValue::Scalar(l), ColumnarValue::Scalar(r)) => 
(l.to_array()?, r.to_array()?),
-    };
+    let arrays = ColumnarValue::values_to_arrays(&[lhs.clone(), rhs.clone()])?;

Review Comment:
   `&[lhs.clone(), rhs.clone()]` builds a temporary vector of cloned 
`ColumnarValue`s only to satisfy the slice signature. `spark_modulo` already 
has `args: &[ColumnarValue]`, so `checked_float_modulo` can take `args` and 
pass it straight through, as `checked_arithmetic_internal` and 
`spark_decimal_div_internal` do. The final `matches!((lhs, rhs), ...)` can then 
use `&args[0]` and `&args[1]`.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to