wesm commented on a change in pull request #7341:
URL: https://github.com/apache/arrow/pull/7341#discussion_r435305624
##########
File path: cpp/src/arrow/compute/api_scalar.h
##########
@@ -48,6 +48,26 @@ namespace compute {
ARROW_EXPORT
Result<Datum> Add(const Datum& left, const Datum& right, ExecContext* ctx =
NULLPTR);
+/// \brief Subtract two values. Array values must be the same length. If a
Review comment:
Can you write out the names of these functions, `Subtract` and
`Multiply`?
##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.h
##########
@@ -522,53 +503,56 @@ struct ScalarUnaryNotNull {
// // implementation
// }
// };
-template <typename OutType, typename Arg0Type, typename Arg1Type, typename Op,
- typename FlippedOp = Op>
+template <typename OutType, typename Arg0Type, typename Arg1Type, typename Op>
struct ScalarBinary {
using OUT = typename GetOutputType<OutType>::T;
using ARG0 = typename GetViewType<Arg0Type>::T;
using ARG1 = typename GetViewType<Arg1Type>::T;
- template <typename ChosenOp>
static void ArrayArray(KernelContext* ctx, const ExecBatch& batch, Datum*
out) {
ArrayIterator<Arg0Type> arg0(*batch[0].array());
ArrayIterator<Arg1Type> arg1(*batch[1].array());
OutputAdapter<OutType>::Write(ctx, out, [&]() -> OUT {
- return ChosenOp::template Call(ctx, arg0(), arg1());
+ return Op::template Call(ctx, arg0(), arg1());
});
}
- template <typename ChosenOp>
static void ArrayScalar(KernelContext* ctx, const ExecBatch& batch, Datum*
out) {
ArrayIterator<Arg0Type> arg0(*batch[0].array());
auto arg1 = UnboxScalar<Arg1Type>::Unbox(batch[1]);
OutputAdapter<OutType>::Write(ctx, out, [&]() -> OUT {
- return ChosenOp::template Call(ctx, arg0(), arg1);
+ return Op::template Call(ctx, arg0(), arg1);
+ });
+ }
+
+ static void ScalarArray(KernelContext* ctx, const ExecBatch& batch, Datum*
out) {
Review comment:
I'm not thrilled about this because you're generating extra compiled
code that wasn't there before
----------------------------------------------------------------
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]