andygrove opened a new issue, #6982: URL: https://github.com/apache/datafusion-comet/issues/6982
### What is the problem the feature request solves? The same match that turns a `(ColumnarValue, ColumnarValue)` pair into two equal-length `ArrayRef`s is pasted into several math functions in `native/spark-expr/src/math_funcs/`: - [checked_arithmetic.rs `checked_arithmetic_internal` (L348-L359)](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/spark-expr/src/math_funcs/checked_arithmetic.rs#L348-L359), plus a similar block at L186-L195 in the same file - [div.rs `spark_decimal_div_internal` (L87-L102)](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/spark-expr/src/math_funcs/div.rs#L87-L102) - [modulo_expr.rs `checked_float_modulo` (L91-L102)](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/spark-expr/src/math_funcs/modulo_expr.rs#L91-L102) - [wide_decimal_binary_expr.rs `WideDecimalBinaryExpr::evaluate` (L196-L212)](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/spark-expr/src/math_funcs/wide_decimal_binary_expr.rs#L196-L212) The copies are identical apart from variable names, so there is no drift today, but they all need to change together if scalar broadcasting behaviour changes. ### Describe the potential solution Replace the copies with `ColumnarValue::values_to_arrays(&[left, right])` from DataFusion, or, if the scalar-scalar length-1 behaviour needs to stay explicit, a single `broadcast_pair(l, r) -> Result<(ArrayRef, ArrayRef)>` helper in `math_funcs`, and call it from each site. ### Additional context This is small and a good first issue. Line references are pinned to commit 7d8d9b1544b7. -- 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]
