kszucs commented on a change in pull request #7341:
URL: https://github.com/apache/arrow/pull/7341#discussion_r434501653
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -21,21 +21,44 @@ namespace arrow {
namespace compute {
struct Add {
- template <typename OUT, typename ARG0, typename ARG1>
- static constexpr OUT Call(KernelContext*, ARG0 left, ARG1 right) {
+ template <typename ARG0, typename ARG1>
+ static constexpr auto Call(KernelContext*, ARG0 left, ARG1 right)
+ -> decltype(left + right) {
return left + right;
}
};
namespace codegen {
+template <typename Op, typename ArgType, typename OutType>
+void AddBinaryKernel(const std::shared_ptr<ScalarFunction>& func) {
+ // create an exec function with the requested signature
+ ArrayKernelExec exec = ScalarBinaryEqualTypes<OutType, ArgType, Op>::Exec;
Review comment:
Using `ScalarBinaryEqualTypes` make the kernel support both Scalar and
Array shaped inputs.
----------------------------------------------------------------
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:
[email protected]