jonkeane commented on a change in pull request #11652:
URL: https://github.com/apache/arrow/pull/11652#discussion_r746991379
##########
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:
Is it possible to use `nse_funcs$is.integer(args[[1]])` here? It's a bit
odd to use it directly out of `nse_funcs` but we have the same pattern a few
places.
--
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]