cyb70289 commented on a change in pull request #10364: URL: https://github.com/apache/arrow/pull/10364#discussion_r645635893
########## File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc ########## @@ -451,8 +604,45 @@ struct ArithmeticFunction : ScalarFunction { if (auto kernel = DispatchExactImpl(this, *values)) return kernel; return arrow::compute::detail::NoMatchingKernel(this, *values); } + + Result<const Kernel*> DispatchDecimal(std::vector<ValueDescr>* values) const { + if (values->size() == 2) { + std::vector<std::shared_ptr<DataType>> replaced; + RETURN_NOT_OK(GetDecimalBinaryOutput(name(), *values, &replaced)); + (*values)[0].type = std::move(replaced[0]); + (*values)[1].type = std::move(replaced[1]); + } + + using arrow::compute::detail::DispatchExactImpl; + if (auto kernel = DispatchExactImpl(this, *values)) return kernel; + return arrow::compute::detail::NoMatchingKernel(this, *values); + } +}; + +// resolve decimal operation output type +struct DecimalBinaryOutputResolver { + std::string func_name; + + DecimalBinaryOutputResolver(std::string func_name) : func_name(std::move(func_name)) {} + + Result<ValueDescr> operator()(KernelContext*, const std::vector<ValueDescr>& args) { + ARROW_ASSIGN_OR_RAISE(auto out_type, GetDecimalBinaryOutput(func_name, args)); Review comment: This is indeed the problem I'm trying to fix and would like to ask for comment. See my last comment at https://github.com/apache/arrow/pull/10364#issuecomment-854364569 -- 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