Dandandan commented on a change in pull request #275: URL: https://github.com/apache/arrow-rs/pull/275#discussion_r629333194
########## File path: arrow/src/compute/kernels/arity.rs ########## @@ -72,3 +72,40 @@ where let data = into_primitive_array_data::<_, O>(array, buffer); PrimitiveArray::<O>::from(data) } + +/// Applies a nullary and infalible function to generate a primitive array. +/// You should use this instead of the vectorized version when each generated value is different. +pub fn nullary<F, O>(size: usize, op: F) -> PrimitiveArray<O> +where + O: ArrowPrimitiveType, + F: Fn() -> O::Native, +{ + let values = (0..size).map(|_| op()); Review comment: This could use `std::iter::repeat` -- 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: us...@infra.apache.org