wesm commented on a change in pull request #7461: URL: https://github.com/apache/arrow/pull/7461#discussion_r441606788
########## File path: cpp/src/arrow/compute/kernels/codegen_internal.h ########## @@ -485,18 +502,44 @@ struct ScalarUnaryNotNullStateful { struct ArrayExec<Type, enable_if_base_binary<Type>> { static void Exec(const ThisType& functor, KernelContext* ctx, const ExecBatch& batch, Datum* out) { - typename TypeTraits<Type>::BuilderType builder; - VisitArrayValuesInline<Arg0Type>(*batch[0].array(), [&](util::optional<ARG0> v) { - if (v.has_value()) { - KERNEL_RETURN_IF_ERROR(ctx, builder.Append(functor.op.Call(ctx, *v))); - } else { - KERNEL_RETURN_IF_ERROR(ctx, builder.AppendNull()); + // TODO: This code path is currently inadequately tested. + + using offset_type = typename Type::offset_type; Review comment: The validity bitmap is already precomputed (zero-copied, in fact) by the executor so using the builder naively here is computationally wasteful ---------------------------------------------------------------- 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