paleolimbot commented on a change in pull request #11133:
URL: https://github.com/apache/arrow/pull/11133#discussion_r706440071
##########
File path: r/tests/testthat/test-dplyr.R
##########
@@ -1035,10 +1035,20 @@ test_that("log functions", {
df
)
- expect_error(
- nse_funcs$log(Expression$scalar(x), base = 5),
- "`base` values other than exp(1), 2 and 10 not supported by Arrow",
- fixed = TRUE
+ expect_dplyr_equal(
+ input %>%
+ mutate(y = log(x, base = 5)) %>%
+ collect(),
+ df
+ )
+
+ expect_dplyr_equal(
+ input %>%
+ # suppress 'NaNs produced' warning on the first row of df
+ # that evaluates to NaN (R raises warning but Arrow does not)
+ suppressWarnings(mutate(., y = log(x, base = x))) %>%
Review comment:
I uncovered another corner case in testing this (`log(10, base = 1)`
evaluates to `Inf` in both R and Arrow). I think the latest commit does this
well without silencing any warnings that come out of the other (more common)
cases!
--
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]