nealrichardson commented on a change in pull request #11133:
URL: https://github.com/apache/arrow/pull/11133#discussion_r708356582
##########
File path: r/tests/testthat/test-dplyr.R
##########
@@ -1035,12 +1035,57 @@ test_that("log functions", {
df
)
+ # test log(, base = (length == 1))
+ expect_dplyr_equal(
+ input %>%
+ mutate(y = log(x, base = 5)) %>%
+ collect(),
+ df
+ )
+
+ # test log(, base = (length != 1))
+ expect_error(
+ nse_funcs$log(10, base = 5:6),
+ "base must be a column or a length-1 numeric; other values not supported
by Arrow",
+ fixed = TRUE
+ )
+
+ # test log(x = (length != 1))
expect_error(
- nse_funcs$log(Expression$scalar(x), base = 5),
- "`base` values other than exp(1), 2 and 10 not supported by Arrow",
+ nse_funcs$log(10:11),
+ "x must be a column or a length-1 numeric; other values not supported by
Arrow",
fixed = TRUE
)
+ # test log(, base = Expression)
+ expect_dplyr_equal(
+ input %>%
+ # test cases where base = 1 below
+ filter(x != 1) %>%
+ mutate(y = log(x, base = x)) %>%
Review comment:
We should have a test for the scalar `x` case, how about this?
```suggestion
mutate(
y = log(x, base = x),
z = log(2, base = x)
) %>%
```
--
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]