bkietz commented on code in PR #40223:
URL: https://github.com/apache/arrow/pull/40223#discussion_r1507658484
##########
cpp/src/arrow/compute/expression.cc:
##########
@@ -536,11 +536,34 @@ Result<Expression> BindNonRecursive(Expression::Call
call, bool insert_implicit_
std::vector<TypeHolder> types = GetTypes(call.arguments);
ARROW_ASSIGN_OR_RAISE(call.function, GetFunction(call, exec_context));
+ auto FinishBind = [&] {
+ compute::KernelContext kernel_context(exec_context, call.kernel);
+ if (call.kernel->init) {
+ const FunctionOptions* options =
+ call.options ? call.options.get() : call.function->default_options();
+ ARROW_ASSIGN_OR_RAISE(
+ call.kernel_state,
+ call.kernel->init(&kernel_context, {call.kernel, types, options}));
+
+ kernel_context.SetState(call.kernel_state.get());
+ }
+
+ ARROW_ASSIGN_OR_RAISE(
+ call.type, call.kernel->signature->out_type().Resolve(&kernel_context,
types));
+ return Status::OK();
+ };
+
// First try and bind exactly
Result<const Kernel*> maybe_exact_match =
call.function->DispatchExact(types);
if (maybe_exact_match.ok()) {
call.kernel = *maybe_exact_match;
- } else {
+
+ if (FinishBind().ok()) {
+ return Expression(std::move(call));
+ }
+ }
+
+ {
Review Comment:
Would you mind deleting this brace and the corresponding close? I included
them in my suggestions earlier only to decrease the size of the diff
```suggestion
```
--
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]