wesm commented on code in PR #13654:
URL: https://github.com/apache/arrow/pull/13654#discussion_r925623322
##########
cpp/src/arrow/compute/kernels/scalar_compare.cc:
##########
@@ -171,22 +343,28 @@ struct CompareTimestamps
"Cannot compare timestamp with timezone to timestamp without
timezone, got: ",
lhs, " and ", rhs);
}
- return Base::Exec(ctx, batch, out);
+ return CompareKernel<Int64Type>::Exec(ctx, batch, out);
}
};
template <typename Op>
-void AddIntegerCompare(const std::shared_ptr<DataType>& ty, ScalarFunction*
func) {
- auto exec =
- GeneratePhysicalInteger<applicator::ScalarBinaryEqualTypes, BooleanType,
Op>(*ty);
- DCHECK_OK(func->AddKernel({ty, ty}, boolean(), std::move(exec)));
+ScalarKernel GetCompareKernel(InputType ty, Type::type compare_type,
+ ArrayKernelExec exec) {
+ ScalarKernel kernel;
+ kernel.signature = KernelSignature::Make({ty, ty}, boolean());
+ BinaryKernel func_aa = GetBinaryKernel<ComparePrimitive, Op>(compare_type);
+ BinaryKernel func_sa = GetBinaryKernel<ComparePrimitiveSA, Op>(compare_type);
+ BinaryKernel func_as = GetBinaryKernel<ComparePrimitiveAS, Op>(compare_type);
+ kernel.data = std::make_shared<CompareData>(func_aa, func_sa, func_as);
+ kernel.exec = exec;
+ return kernel;
}
-template <typename InType, typename Op>
-void AddGenericCompare(const std::shared_ptr<DataType>& ty, ScalarFunction*
func) {
- DCHECK_OK(
- func->AddKernel({ty, ty}, boolean(),
- applicator::ScalarBinaryEqualTypes<BooleanType, InType,
Op>::Exec));
+template <typename Op>
+void AddPrimitiveCompare(const std::shared_ptr<DataType>& ty, ScalarFunction*
func) {
+ ArrayKernelExec exec = GeneratePhysicalNumeric<CompareKernel>(ty);
+ ScalarKernel kernel = GetCompareKernel<Op>(ty, ty->id(), exec);
Review Comment:
They have different return types. I'll generalize in codegen_internal.h
--
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]