ianmcook commented on a change in pull request #9805:
URL: https://github.com/apache/arrow/pull/9805#discussion_r602304700
##########
File path: r/R/dplyr.R
##########
@@ -279,6 +280,19 @@ arrow_eval <- function (expr, mask) {
}
invisible(structure(msg, class = "try-error", condition = e))
})
+ # Check that the evaluated expression has one of the expected classes or
types
+ if (!inherits(out, c("array_expression", "Expression", "try-error")) &&
+ !typeof(out) %in% c("logical", "integer", "double", "character",
"NULL")) {
Review comment:
I'll dig into this more to be sure. Whether we use a passlist or
blocklist for the types is probably not too important because there is a
[finite and relatively small number of possible
types](https://github.com/wch/r-source/blob/trunk/src/main/util.c#L192-L222).
FYI check out
[`rlang::is_syntactic_literal()`](https://rlang.r-lib.org/reference/is_expression.html)
which is defined like so:
```r
function (x)
{
switch(typeof(x), `NULL` = {
TRUE
}, logical = , integer = , double = , character = {
length(x) == 1
}, complex = {
if (length(x) != 1) {
return(FALSE)
}
is_na(x) || Re(x) == 0
}, FALSE)
}
```
That was my starting point for this. But I agree we should at least add
`"raw"` to that.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]