Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test if data.table and tibble installed, rewrite one for data.frame #632

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tiledb
Type: Package
Version: 0.22.0.3
Version: 0.22.0.4
Title: Modern Database Engine for Multi-Modal Data via Sparse and Dense Multidimensional Arrays
Authors@R: c(person("TileDB, Inc.", role = c("aut", "cph")),
person("Dirk", "Eddelbuettel", email = "dirk@tiledb.com", role = "cre"))
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

* Builds from TileDB Core non-release tarballs are now supported via new configure option (#627)

* Tests are more careful about using suggested packages only when present (#632)


# tiledb 0.22.0

Expand Down
10 changes: 5 additions & 5 deletions inst/tinytest/test_arrayschemaevolution.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ run_int_col_test <- function(coltype) {
arr[] <- df

qc <-
res <- tiledb_array(uri, return_as="data.table", query_condition = parse_query_condition(fct == blue, arr))[]
res <- tiledb_array(uri, return_as="data.frame", query_condition = parse_query_condition(fct == blue, arr))[]
expect_equal(nrow(res), 5)

res <- tiledb_array(uri, return_as="data.table", query_condition = parse_query_condition(fct == green, arr))[]
res <- tiledb_array(uri, return_as="data.frame", query_condition = parse_query_condition(fct == green, arr))[]
expect_equal(nrow(res), 3)

res <- tiledb_array(uri, return_as="data.table", query_condition = parse_query_condition(fct == red, arr))[]
res <- tiledb_array(uri, return_as="data.frame", query_condition = parse_query_condition(fct == red, arr))[]
expect_equal(nrow(res), 2)

res <- tiledb_array(uri, return_as="data.table", query_condition = parse_query_condition(fct != blue, arr))[]
res <- tiledb_array(uri, return_as="data.frame", query_condition = parse_query_condition(fct != blue, arr))[]
expect_equal(nrow(res), 5)

expect_error(tiledb_array(uri, return_as="data.table", query_condition = parse_query_condition(fct > blue, arr))[])
expect_error(tiledb_array(uri, return_as="data.frame", query_condition = parse_query_condition(fct > blue, arr))[])

unlink(uri)
}
Expand Down
24 changes: 14 additions & 10 deletions inst/tinytest/test_ordered.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,21 @@ expect_false(is.ordered(dfval$sex))
expect_true(is.factor(dfval$sex))
expect_equivalent(et, dfval)

dtval <- tiledb_array(uri, return_as="data.table", extended=FALSE)[]
expect_true(is.ordered(dtval$pclass))
expect_false(is.ordered(dtval$sex))
expect_true(is.factor(dtval$sex))
expect_equivalent(et, dtval)
if (requireNamespace("data.table", quietly=TRUE)) {
dtval <- tiledb_array(uri, return_as="data.table", extended=FALSE)[]
expect_true(is.ordered(dtval$pclass))
expect_false(is.ordered(dtval$sex))
expect_true(is.factor(dtval$sex))
expect_equivalent(et, dtval)
}

tbval <- tiledb_array(uri, return_as="tibble", extended=FALSE)[]
expect_true(is.ordered(tbval$pclass))
expect_false(is.ordered(tbval$sex))
expect_true(is.factor(tbval$sex))
expect_equivalent(et, tbval)
if (requireNamespace("tibble", quietly=TRUE)) {
tbval <- tiledb_array(uri, return_as="tibble", extended=FALSE)[]
expect_true(is.ordered(tbval$pclass))
expect_false(is.ordered(tbval$sex))
expect_true(is.factor(tbval$sex))
expect_equivalent(et, tbval)
}

if (Sys.getenv("CI", "") != "" && requireNamespace("arrow", quietly=TRUE)) {
arval <- tiledb_array(uri, return_as="arrow", extended=FALSE)[]
Expand Down