Skip to content

Commit

Permalink
MINOR: [R] Fix a package namespace warning (#43737)
Browse files Browse the repository at this point in the history
Oops, I should have caught this in #43633 Removes `data.table::` since the namespace is loaded. Also fix some linting errors and free up space on the force tests run.

Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Jonathan Keane <[email protected]>
  • Loading branch information
jonkeane authored Aug 17, 2024
1 parent 49be60f commit fbac12c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/r.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ jobs:
with:
fetch-depth: 0
submodules: recursive
- name: Free up disk space
run: |
ci/scripts/util_free_space.sh
- name: Cache Docker Volumes
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
Expand Down
16 changes: 8 additions & 8 deletions r/tests/testthat/test-extra-package-roundtrip.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ skip_on_cran()
# So that we can force these in CI
load_or_skip <- function(pkg) {
if (identical(tolower(Sys.getenv("ARROW_R_FORCE_EXTRA_PACKAGE_TESTS")), "true")) {
# because of this indirection on the package name we also avoid a CHECK note and
# because of this indirection on the package name we also avoid a CHECK note and
# we don't otherwise need to Suggest this
requireNamespace(pkg, quietly = TRUE)
} else {
Expand All @@ -46,11 +46,11 @@ test_that("readr read csvs roundtrip", {

# we should still be able to turn this into a table
new_df <- read_csv(tf, show_col_types = FALSE)
expect_equal(new_df, as_tibble(arrow_table(new_df)))
expect_equal(new_df, as_tibble(arrow_table(new_df)))

# we should still be able to turn this into a table
new_df <- read_csv(tf, show_col_types = FALSE, lazy = TRUE)
expect_equal(new_df, as_tibble(arrow_table(new_df)))
expect_equal(new_df, as_tibble(arrow_table(new_df)))

# and can roundtrip to a parquet file
pq_tmp_file <- tempfile()
Expand All @@ -65,11 +65,11 @@ test_that("data.table objects roundtrip", {
load_or_skip("data.table")

# https://github.com/Rdatatable/data.table/blob/83fd2c05ce2d8555ceb8ba417833956b1b574f7e/R/cedta.R#L25-L27
.datatable.aware=TRUE
.datatable.aware <- TRUE

DT <- as.data.table(example_data)

# Table -> collect which is what writing + reading to parquet uses under the hood to roundtrip
# Table to collect which is what writing + reading to parquet uses under the hood to roundtrip
tab <- as_arrow_table(DT)
DT_read <- collect(tab)

Expand All @@ -80,9 +80,9 @@ test_that("data.table objects roundtrip", {
# and we can set keys + indices + create new columns
setkey(DT, chr)
setindex(DT, dbl)
DT[, dblshift := data.table::shift(dbl, 1)]
DT[, dblshift := shift(dbl, 1)]

# Table -> collect
# Table to collect
tab <- as_arrow_table(DT)
DT_read <- collect(tab)

Expand All @@ -96,7 +96,7 @@ test_that("units roundtrip", {
tbl <- example_data
units(tbl$dbl) <- "s"

# Table -> collect which is what writing + reading to parquet uses under the hood to roundtrip
# Table to collect which is what writing + reading to parquet uses under the hood to roundtrip
tab <- as_arrow_table(tbl)
tbl_read <- collect(tab)

Expand Down

0 comments on commit fbac12c

Please sign in to comment.