ZhangHuiGui commented on code in PR #40223:
URL: https://github.com/apache/arrow/pull/40223#discussion_r1505840337


##########
cpp/src/arrow/compute/expression.cc:
##########
@@ -536,14 +566,21 @@ 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));
 
-  // 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 (!insert_implicit_casts) {
-      return maybe_exact_match.status();
+  bool maybe_need_dispatch_best = IsNeedDispatchBest(types, 
call.function_name);

Review Comment:
   Maybe we misunderstood the current logic, i mean that the 
[DispatchExact](https://github.com/apache/arrow/pull/40223/files#diff-81305966f880c8e3a51f4df82e8c042b2946f162c5b2f099b2f328097c3dd4caL541)
 will always return ok in current logic.
   1. The `ResolveDecimalxxx` functions called in `BindNonRecursive` at 
[call.kernel->signature->out_type().Resolve](https://github.com/apache/arrow/blob/19e874ff8c6d960a58ee91a9605e133d99fec3f9/cpp/src/arrow/compute/expression.cc#L591),
 it'a called after the `DispatchExact` and `DispatchBest`.
   2.  `ScalarFunction` didn't override the `DispatchExact`, So 
[DispatchExact](https://github.com/apache/arrow/pull/40223/files#diff-81305966f880c8e3a51f4df82e8c042b2946f162c5b2f099b2f328097c3dd4caL541)
 will go into  
[Function::DispatchExact](https://github.com/apache/arrow/blob/19e874ff8c6d960a58ee91a9605e133d99fec3f9/cpp/src/arrow/compute/function.cc#L297)
 which will always return ok  for the input decimal type can be matched and 
also won't go into the `Resolvexxx` functions which called in `Resolve` lazily 
in fact.



-- 
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]

Reply via email to