pitrou commented on code in PR #13364: URL: https://github.com/apache/arrow/pull/13364#discussion_r896852788
########## cpp/src/arrow/compute/function.cc: ########## @@ -249,11 +250,39 @@ Result<Datum> Function::Execute(const std::vector<Datum>& args, } else { return Status::NotImplemented("Direct execution of HASH_AGGREGATE functions"); } + + ARROW_ASSIGN_OR_RAISE(auto kernel, DispatchBest(&inputs)); + ARROW_ASSIGN_OR_RAISE(std::vector<Datum> args_with_casts, Cast(args, inputs, ctx)); + + std::unique_ptr<KernelState> state; + KernelContext kernel_ctx{ctx}; + if (kernel->init) { + ARROW_ASSIGN_OR_RAISE(state, kernel->init(&kernel_ctx, {kernel, inputs, options})); + kernel_ctx.SetState(state.get()); + } + RETURN_NOT_OK(executor->Init(&kernel_ctx, {kernel, inputs, options})); detail::DatumAccumulator listener; - RETURN_NOT_OK(executor->Execute(implicitly_cast_args, &listener)); - const auto out = executor->WrapResults(implicitly_cast_args, listener.values()); + + // Set length to 0 unless it's a scalar function (vector functions don't use + // it). Review Comment: I suppose vector functions could use it at some point? -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org