nealrichardson commented on a change in pull request #11133:
URL: https://github.com/apache/arrow/pull/11133#discussion_r707639794
##########
File path: r/R/dplyr-functions.R
##########
@@ -694,6 +694,14 @@ nse_funcs$wday <- function(x, label = FALSE, abbr = TRUE,
week_start = getOption
}
nse_funcs$log <- nse_funcs$logb <- function(x, base = exp(1)) {
+ if (inherits(base, "Expression")) {
+ return(Expression$create("logb_checked", x, base))
+ }
+
+ if (!is.numeric(base) || length(base) != 1) {
+ arrow_not_supported("base with length != 1")
Review comment:
Kinda lame but this is the best I can come up with right now
```suggestion
arrow_not_supported("base must be either a column in the data or a
length-1 scalar; other values")
```
##########
File path: r/R/dplyr-functions.R
##########
@@ -694,6 +694,14 @@ nse_funcs$wday <- function(x, label = FALSE, abbr = TRUE,
week_start = getOption
}
nse_funcs$log <- nse_funcs$logb <- function(x, base = exp(1)) {
+ if (inherits(base, "Expression")) {
+ return(Expression$create("logb_checked", x, base))
+ }
+
+ if (!is.numeric(base) || length(base) != 1) {
+ arrow_not_supported("base with length != 1")
+ }
+
Review comment:
To your other question, you could check here whether `x` is numeric
length 1 and return `base::log(x, base)`. I'd add a comment showing the use
case, just to be clear.
--
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]