bkietz commented on a change in pull request #9294: URL: https://github.com/apache/arrow/pull/9294#discussion_r566360286
########## File path: cpp/src/arrow/compute/function.cc ########## @@ -21,62 +21,66 @@ #include <memory> #include <sstream> +#include "arrow/compute/cast.h" #include "arrow/compute/exec.h" #include "arrow/compute/exec_internal.h" +#include "arrow/compute/kernels/common.h" #include "arrow/datum.h" #include "arrow/util/cpu_info.h" namespace arrow { + +using internal::checked_cast; + namespace compute { static const FunctionDoc kEmptyFunctionDoc{}; const FunctionDoc& FunctionDoc::Empty() { return kEmptyFunctionDoc; } -Status Function::CheckArity(int passed_num_args) const { - if (arity_.is_varargs && passed_num_args < arity_.num_args) { - return Status::Invalid("VarArgs function needs at least ", arity_.num_args, - " arguments but kernel accepts only ", passed_num_args); - } else if (!arity_.is_varargs && passed_num_args != arity_.num_args) { - return Status::Invalid("Function accepts ", arity_.num_args, - " arguments but kernel accepts ", passed_num_args); +Status CheckArityImpl(const Function* function, int passed_num_args, + const char* passed_num_args_label) { + if (function->arity().is_varargs && passed_num_args < function->arity().num_args) { + return Status::Invalid("VarArgs function needs at least ", function->arity().num_args, Review comment: will do ---------------------------------------------------------------- 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