edponce commented on a change in pull request #10567:
URL: https://github.com/apache/arrow/pull/10567#discussion_r655918970



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -734,6 +924,19 @@ std::shared_ptr<ScalarFunction> 
MakeUnarySignedArithmeticFunctionNotNull(
   return func;
 }
 
+// Integer arguments return double values
+template <typename Op>
+std::shared_ptr<ScalarFunction> MakeUnaryIntToDoubleNotNull(std::string name,
+                                                            const FunctionDoc* 
doc) {
+  auto func = std::make_shared<ArithmeticFunction>(name, Arity::Unary(), doc);
+  for (const auto& ty : NumericTypes()) {
+    auto output = is_integer(ty->id()) ? float64() : ty;
+    auto exec = IntToDoubleExecFromOp<ScalarUnaryNotNull, Op>(ty);
+    DCHECK_OK(func->AddKernel({ty}, output, exec));
+  }
+  return func;
+}
+

Review comment:
       I suggest to change the function name to 
`MakeUnaryArithmeticFunctionFloatOutTypeNotNull`.
   Also, the `_checked` variants use the `ScalarUnaryNotNull` kernel exec 
generator but the regular variants use `ScalarUnary`. Need to add 
`MakeUnaryArithmeticFunctionFloatOutType` with same logic but using 
`ScalarUnary`.




-- 
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]


Reply via email to