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


##########
native/spark-expr/src/math_funcs/internal/normalize_nan.rs:
##########
@@ -78,14 +79,16 @@ impl PhysicalExpr for NormalizeNaNAndZero {
 
         match &self.data_type {
             DataType::Float32 => {
-                let v = eval_typed(as_primitive_array::<Float32Type>(&array));
-                let new_array = Float32Array::from(v);
-                Ok(ColumnarValue::Array(Arc::new(new_array)))
+                let input = as_primitive_array::<Float32Type>(&array);
+                // Use unary which operates directly on values buffer without 
intermediate allocation
+                let result: Float32Array = unary(input, normalize_float);

Review Comment:
   👍 `unary` is fast but it requires the operation to be infallible



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