simonvandel commented on code in PR #12889:
URL: https://github.com/apache/datafusion/pull/12889#discussion_r1797769533


##########
datafusion/physical-expr/src/math_expressions.rs:
##########
@@ -17,60 +17,27 @@
 
 //! Math expressions
 
-use std::any::type_name;
 use std::sync::Arc;
 
-use arrow::array::ArrayRef;
-use arrow::array::{BooleanArray, Float32Array, Float64Array};
-use arrow::datatypes::DataType;
+use arrow::array::BooleanArray;
+use arrow::array::{ArrayRef, AsArray};
+use arrow::datatypes::{DataType, Float32Type, Float64Type};
 use arrow_array::Array;
 
 use datafusion_common::exec_err;
-use datafusion_common::{DataFusionError, Result};
-
-macro_rules! downcast_arg {
-    ($ARG:expr, $NAME:expr, $ARRAY_TYPE:ident) => {{
-        $ARG.as_any().downcast_ref::<$ARRAY_TYPE>().ok_or_else(|| {
-            DataFusionError::Internal(format!(
-                "could not cast {} from {} to {}",
-                $NAME,
-                $ARG.data_type(),
-                type_name::<$ARRAY_TYPE>()
-            ))
-        })?
-    }};
-}
-
-macro_rules! make_function_scalar_inputs_return_type {
-    ($ARG: expr, $NAME:expr, $ARGS_TYPE:ident, $RETURN_TYPE:ident, $FUNC: 
block) => {{
-        let arg = downcast_arg!($ARG, $NAME, $ARGS_TYPE);
-
-        arg.iter()
-            .map(|a| match a {
-                Some(a) => Some($FUNC(a)),
-                _ => None,
-            })
-            .collect::<$RETURN_TYPE>()
-    }};
-}
+use datafusion_common::Result;
 
 /// Isnan SQL function
 pub fn isnan(args: &[ArrayRef]) -> Result<ArrayRef> {

Review Comment:
   You are absolutely right.
   Changing the right function does indeed give a speed-up.
   
   I have left out the cleanup of the `isnan` of math_expressions.rs out of 
this PR now.



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