pitrou commented on a change in pull request #8457:
URL: https://github.com/apache/arrow/pull/8457#discussion_r505671134



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -277,29 +278,80 @@ std::shared_ptr<ScalarFunction> 
MakeArithmeticFunction(std::string name) {
 // Like MakeArithmeticFunction, but for arithmetic ops that need to run
 // only on non-null output.
 template <typename Op>
-std::shared_ptr<ScalarFunction> MakeArithmeticFunctionNotNull(std::string 
name) {
-  auto func = std::make_shared<ScalarFunction>(name, Arity::Binary());
+std::shared_ptr<ScalarFunction> MakeArithmeticFunctionNotNull(std::string name,
+                                                              FunctionDoc doc) 
{
+  auto func = std::make_shared<ScalarFunction>(name, Arity::Binary(), 
std::move(doc));
   for (const auto& ty : NumericTypes()) {
     auto exec = NumericEqualTypesBinary<ScalarBinaryNotNullEqualTypes, Op>(ty);
     DCHECK_OK(func->AddKernel({ty, ty}, ty, exec));
   }
   return func;
 }
 
+FunctionDoc add_doc{"Add the elements of two arrays",
+                    ("Results will wrap around on integer overflow.\n"
+                     "Use function \"add_checked\" if you want overflow\n"
+                     "to return an error."),
+                    {"x", "y"}};
+
+FunctionDoc add_checked_doc{
+    "Add the elements of two arrays",
+    ("This function returns an error on overflow.  For a variant that\n"
+     "doesn't fail on overflow, use function \"add\"."),
+    {"x", "y"}};
+
+FunctionDoc sub_doc{"Substract the elements of an array from another",
+                    ("Results will wrap around on integer overflow.\n"
+                     "Use function \"subtract_checked\" if you want overflow\n"
+                     "to return an error."),
+                    {"x", "y"}};
+
+FunctionDoc sub_checked_doc{
+    "Substract the elements of an array from another",
+    ("This function returns an error on overflow.  For a variant that\n"
+     "doesn't fail on overflow, use function \"subtract\"."),
+    {"x", "y"}};
+
+FunctionDoc mul_doc{"Multiply the elements of two arrays",
+                    ("Results will wrap around on integer overflow.\n"
+                     "Use function \"multiply_checked\" if you want overflow\n"
+                     "to return an error."),
+                    {"x", "y"}};
+
+FunctionDoc mul_checked_doc{
+    "Multiply the elements of two arrays",
+    ("This function returns an error on overflow.  For a variant that\n"
+     "doesn't fail on overflow, use function \"multiply\"."),
+    {"x", "y"}};
+
+FunctionDoc div_doc{"Divide the elements of an array by another",
+                    ("An error is returned when trying to divide by zero.\n"

Review comment:
       Right, will do.




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