bkietz commented on a change in pull request #10113:
URL: https://github.com/apache/arrow/pull/10113#discussion_r620393593
##########
File path: cpp/src/arrow/compute/kernels/scalar_arithmetic_test.cc
##########
@@ -817,5 +932,126 @@ TEST(TestBinaryArithmetic,
AddWithImplicitCastsUint64EdgeCase) {
ArrayFromJSON(uint64(),
"[18446744073709551615]")}));
}
+TEST(TestUnaryArithmetic, DispatchBest) {
+ for (std::string name : {"negate"}) {
+ for (const auto& ty : {int8(), int16(), int32(), int64(), uint8(),
uint16(), uint32(),
+ uint64(), float32(), float64()}) {
+ CheckDispatchBest(name, {ty}, {ty});
+ CheckDispatchBest(name, {dictionary(int8(), ty)}, {ty});
+ }
+ }
+
Review comment:
Please add a test asserting the behavior when `NullType` is used. I
expect this will emit a "no kernel found" error (acceptable), or leave the type
unpromoted:
```suggestion
CheckDispatchBest("negate", {null()}, {null()});
```
This would also be fine, but I'd like to see a trivial test case asserting
we don't try to access absent buffers:
```c++
CheckScalarUnary("negate", NullArray(10), NullArray(10));
```
--
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]