paleolimbot commented on a change in pull request #11652:
URL: https://github.com/apache/arrow/pull/11652#discussion_r748217770
##########
File path: r/R/arrow-datum.R
##########
@@ -102,8 +102,18 @@ eval_array_expression <- function(FUN,
args <- map(args, ~ .$cast(float64()))
} else if (FUN == "%/%") {
# In R, integer division works like floor(float division)
- out <- eval_array_expression("/", args = args, options = options)
- return(out$cast(int32(), allow_float_truncate = TRUE))
+ out <- eval_array_expression("/", args = args)
+
+ # integer output only for all integer input
+ int_type_ids <- Type[toupper(INTEGER_TYPES)]
+ numerator_is_int <- args[[1]]$type_id() %in% int_type_ids
+ denominator_is_int <- args[[2]]$type_id() %in% int_type_ids
Review comment:
I'm hesitant to do that because this code got copy/pasted to the Ops for
Datum where that won't work (but `type_id()` does because Datum has that
method).
--
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]