jorgecarleitao commented on a change in pull request #8116:
URL: https://github.com/apache/arrow/pull/8116#discussion_r484498652
##########
File path: rust/datafusion/src/physical_plan/math_expressions.rs
##########
@@ -19,23 +19,25 @@
use crate::error::{ExecutionError, Result};
-use arrow::array::{Array, ArrayRef, Float32Array, Float64Array,
Float64Builder};
+use arrow::array::{Array, ArrayRef, Float32Array, Float64Array};
use arrow::datatypes::DataType;
use std::sync::Arc;
macro_rules! compute_op {
($ARRAY:expr, $FUNC:ident, $TYPE:ident) => {{
- let mut builder = Float64Builder::new($ARRAY.len());
- for i in 0..$ARRAY.len() {
- if $ARRAY.is_null(i) {
- builder.append_null()?;
- } else {
- builder.append_value($ARRAY.value(i).$FUNC() as f64)?;
- }
- }
- Ok(Arc::new(builder.finish()))
+ let result: Float64Array = (0..$ARRAY.len())
+ .map(|i| {
Review comment:

Now, seriously, I think that we should merge this change instead of mine
(maybe keep the benchmark commit).
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]