bkietz commented on a change in pull request #10016:
URL: https://github.com/apache/arrow/pull/10016#discussion_r614139893



##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic.cc
##########
@@ -309,6 +348,21 @@ std::shared_ptr<ScalarFunction> 
MakeArithmeticFunctionNotNull(std::string name,
   return func;
 }
 

Review comment:
       `ScalarFunction` does not provide implicit casts, such as from unsigned 
to signed integers. `UnaryScalarFunction` is provided to add implicit casts 
including:
   
   ```
   uint8 -> int16
   uint16 -> int32
   uint32 -> int64
   uint64 -> int64
   dictionary<int32, float> -> float
   //...
   ```
   
   The call to CommonNumeric with int8 ensures that the output type is signed, 
with no more widening than necessary. Insertion of implicit casts is tested for 
the other arithmetic functions using 
[CheckDispatchBest](https://github.com/apache/arrow/blob/b4806a0eefb5b21e9f44cac1c7c9113a4c31ad01/cpp/src/arrow/compute/kernels/scalar_arithmetic_test.cc#L645)
   




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