Skip to content

Commit

Permalink
Skip dplyr tests if dataset not in build
Browse files Browse the repository at this point in the history
  • Loading branch information
nealrichardson committed May 13, 2021
1 parent 52643dd commit fa5731e
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 19 deletions.
7 changes: 4 additions & 3 deletions r/tests/testthat/test-RecordBatch.R
Original file line number Diff line number Diff line change
Expand Up @@ -500,19 +500,20 @@ test_that("Handling string data with embedded nuls", {
})

test_that("ARROW-11769 - grouping preserved in record batch creation", {

skip_if_not_available("dataset")

tbl <- tibble::tibble(
int = 1:10,
fct = factor(rep(c("A", "B"), 5)),
fct2 = factor(rep(c("C", "D"), each = 5)),
)

expect_identical(
tbl %>%
dplyr::group_by(fct, fct2) %>%
record_batch() %>%
dplyr::group_vars(),
c("fct", "fct2")
)

})
7 changes: 4 additions & 3 deletions r/tests/testthat/test-Table.R
Original file line number Diff line number Diff line change
Expand Up @@ -476,19 +476,20 @@ test_that("Table$create() with different length columns", {
})

test_that("ARROW-11769 - grouping preserved in table creation", {

skip_if_not_available("dataset")

tbl <- tibble::tibble(
int = 1:10,
fct = factor(rep(c("A", "B"), 5)),
fct2 = factor(rep(c("C", "D"), each = 5)),
)

expect_identical(
tbl %>%
dplyr::group_by(fct, fct2) %>%
Table$create() %>%
dplyr::group_vars(),
c("fct", "fct2")
)

})
3 changes: 2 additions & 1 deletion r/tests/testthat/test-compute-arith.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ test_that("Power", {
test_that("Dates casting", {
a <- Array$create(c(Sys.Date() + 1:4, NA_integer_))

skip("autocasting should happen in compute kernels; R workaround fails on this ARROW-8919")
skip("ARROW-11090 (date/datetime arithmetic)")
# Error: NotImplemented: Function add_checked has no kernel matching input types (array[date32[day]], scalar[double])
expect_equal(a + 2, Array$create(c((Sys.Date() + 1:4 ) + 2), NA_integer_))
})
17 changes: 5 additions & 12 deletions r/tests/testthat/test-compute-sort.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,28 +138,21 @@ test_that("sort(vector), sort(Array), sort(ChunkedArray) give equivalent results
})

test_that("Table$SortIndices()", {
x <- Table$create(tbl)
expect_identical(
{
x <- tbl %>% Table$create()
x$Take(x$SortIndices("chr")) %>% pull(chr)
},
as.vector(x$Take(x$SortIndices("chr"))$chr),
sort(tbl$chr, na.last = TRUE)
)
expect_identical(
{
x <- tbl %>% Table$create()
x$Take(x$SortIndices(c("int", "dbl"), c(FALSE, FALSE))) %>% collect()
},
as.data.frame(x$Take(x$SortIndices(c("int", "dbl"), c(FALSE, FALSE)))),
tbl %>% arrange(int, dbl)
)
})

test_that("RecordBatch$SortIndices()", {
x <- record_batch(tbl)
expect_identical(
{
x <- tbl %>% record_batch()
x$Take(x$SortIndices(c("chr", "int", "dbl"), TRUE)) %>% collect()
},
as.data.frame(x$Take(x$SortIndices(c("chr", "int", "dbl"), TRUE))),
tbl %>% arrange(desc(chr), desc(int), desc(dbl))
)
})
2 changes: 2 additions & 0 deletions r/tests/testthat/test-dplyr-arrange.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

skip_if_not_available("dataset")

library(dplyr)

# randomize order of rows in test data
Expand Down
2 changes: 2 additions & 0 deletions r/tests/testthat/test-dplyr-filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

skip_if_not_available("dataset")

library(dplyr)
library(stringr)

Expand Down
2 changes: 2 additions & 0 deletions r/tests/testthat/test-dplyr-group-by.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

skip_if_not_available("dataset")

library(dplyr)
library(stringr)

Expand Down
2 changes: 2 additions & 0 deletions r/tests/testthat/test-dplyr-mutate.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

skip_if_not_available("dataset")

library(dplyr)
library(stringr)

Expand Down
1 change: 1 addition & 0 deletions r/tests/testthat/test-dplyr-string-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.

skip_if_not_available("dataset")
skip_if_not_available("utf8proc")

library(dplyr)
Expand Down
2 changes: 2 additions & 0 deletions r/tests/testthat/test-dplyr.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

skip_if_not_available("dataset")

library(dplyr)
library(stringr)

Expand Down

0 comments on commit fa5731e

Please sign in to comment.