You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Egill Axfjord Fridgeirsson (Jira)" <ji...@apache.org> on 2022/08/28 10:30:00 UTC
[jira] [Created] (ARROW-17543) [R] %in% on an empty vector c() fails
Egill Axfjord Fridgeirsson created ARROW-17543:
--------------------------------------------------
Summary: [R] %in% on an empty vector c() fails
Key: ARROW-17543
URL: https://issues.apache.org/jira/browse/ARROW-17543
Project: Apache Arrow
Issue Type: Bug
Affects Versions: 9.0.0
Reporter: Egill Axfjord Fridgeirsson
When using %in% on empty vectors I'm getting an error
"Error: Cannot infer type from vector"
I'd expect this to work the same as base R where you can use %in% on empty vectors.
The arrow::is_in compute function does accept nulls as the value_set. If I manually create an empty array of type NULL it does work as expected.
Reprex:
{code:java}
library(dplyr)
library(arrow)
options(arrow.debug=T)
#base R
a <- c(1,2,3)
b <- c() # NULL
a %in% b
#> [1] FALSE FALSE FALSE
# arrow arrays
arrowArray <- arrow::Array$create(c(1,2,3))
arrow::is_in(arrowArray, c())
#> Error: Cannot infer type from vector
# define type of c() manually
arrow::is_in(arrowArray, arrow::Array$create(c(), type=arrow::null()))
#> Array
#> <bool>
#> [
#> false,
#> false,
#> false
#> ]
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)