You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/03/04 00:42:42 UTC
[GitHub] [arrow] nealrichardson commented on a change in pull request #9606: ARROW-10405: [C++] IsIn kernel should be able to lookup dictionary in string
nealrichardson commented on a change in pull request #9606:
URL: https://github.com/apache/arrow/pull/9606#discussion_r586922616
##########
File path: r/tests/testthat/test-Array.R
##########
@@ -723,6 +723,17 @@ test_that("[ accepts Arrays and otherwise handles bad input", {
)
})
+test_that("[ %in% looks up string key in dictionary", {
Review comment:
```suggestion
test_that("%in% works on dictionary arrays", {
```
##########
File path: r/tests/testthat/test-Array.R
##########
@@ -723,6 +723,17 @@ test_that("[ accepts Arrays and otherwise handles bad input", {
)
})
+test_that("[ %in% looks up string key in dictionary", {
+ a1 <- Array$create(as.factor(c("A", "B", "C")))
+ a2 <- DictionaryArray$create(c(0L, 1L, 2L), c(4.5, 3.2, 1.1))
+ b1 <- Array$create(c(FALSE, TRUE, FALSE))
+ b2 <- Array$create(c(FALSE, FALSE, FALSE))
+ expect_equal(b1, arrow:::call_function("is_in_meta_binary", a1, Array$create("B")))
+ expect_equal(b2, arrow:::call_function("is_in_meta_binary", a1, Array$create("D")))
+ expect_equal(b1, arrow:::call_function("is_in_meta_binary", a2, Array$create(3.2)))
+ expect_error(arrow:::call_function("is_in_meta_binary", a2, Array$create("B")))
Review comment:
I would write these as e.g. `expect_equal(a1 %in% "B", b1)` etc.
----------------------------------------------------------------
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:
users@infra.apache.org