lidavidm commented on code in PR #12774:
URL: https://github.com/apache/arrow/pull/12774#discussion_r841702900
##########
cpp/src/arrow/compute/kernels/scalar_arithmetic.cc:
##########
@@ -1818,11 +1818,13 @@ struct ArithmeticFunction : ScalarFunction {
// Only promote types for binary functions
if (values->size() == 2) {
ReplaceNullWithOtherType(values);
-
- if (auto type = CommonTemporalResolution(values->data(),
values->size())) {
+ auto type = CommonTemporalResolution(values->data(), values->size());
+ if (type) {
+ ReplaceTemporalTypes(type, values);
+ } else if (auto numeric_type = CommonNumeric(*values)) {
+ ReplaceTypes(numeric_type, values);
+ } else if (type == TimeUnit::SECOND) {
ReplaceTemporalTypes(type, values);
Review Comment:
Probably because TimeUnit::SECOND is zero :) We should probably change the
output type to wrap in`std::optional` or something, or have `bool
CommonTemporalResolution(..., TimeUnit::type* out_unit)`
--
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]