diff --git a/r/DESCRIPTION b/r/DESCRIPTION index 7b60f0c510af5..90e84d34bc220 100644 --- a/r/DESCRIPTION +++ b/r/DESCRIPTION @@ -41,7 +41,7 @@ Imports: utils, vctrs Roxygen: list(markdown = TRUE, r6 = FALSE, load = "source") -RoxygenNote: 7.2.0 +RoxygenNote: 7.2.1 Config/testthat/edition: 3 VignetteBuilder: knitr Suggests: diff --git a/r/R/arrowExports.R b/r/R/arrowExports.R index 6e76cd6468783..35c73e547c91d 100644 --- a/r/R/arrowExports.R +++ b/r/R/arrowExports.R @@ -2043,4 +2043,3 @@ SetIOThreadPoolCapacity <- function(threads) { Array__infer_type <- function(x) { .Call(`_arrow_Array__infer_type`, x) } - diff --git a/r/R/dplyr-datetime-helpers.R b/r/R/dplyr-datetime-helpers.R index 4c9a8d1bf05bf..ba9bb0d54372b 100644 --- a/r/R/dplyr-datetime-helpers.R +++ b/r/R/dplyr-datetime-helpers.R @@ -442,8 +442,10 @@ parse_period_unit <- function(x) { str_unit <- substr(x, capture_start[[2]], capture_end[[2]]) str_multiple <- substr(x, capture_start[[1]], capture_end[[1]]) - known_units <- c("nanosecond", "microsecond", "millisecond", "second", - "minute", "hour", "day", "week", "month", "quarter", "year") + known_units <- c( + "nanosecond", "microsecond", "millisecond", "second", + "minute", "hour", "day", "week", "month", "quarter", "year" + ) # match the period unit str_unit_start <- substr(str_unit, 1, 3) @@ -464,7 +466,7 @@ parse_period_unit <- function(x) { if (capture_length[[1]] == 0) { multiple <- 1L - # otherwise parse the multiple + # otherwise parse the multiple } else { multiple <- as.numeric(str_multiple) diff --git a/r/R/dplyr-funcs-doc.R b/r/R/dplyr-funcs-doc.R index cac0310f49b2c..cbfe475232b7f 100644 --- a/r/R/dplyr-funcs-doc.R +++ b/r/R/dplyr-funcs-doc.R @@ -88,12 +88,12 @@ #' as `arrow_ascii_is_decimal`. #' #' ## arrow -#' +#' #' * [`add_filename()`][arrow::add_filename()] #' * [`cast()`][arrow::cast()] #' #' ## base -#' +#' #' * [`-`][-()] #' * [`!`][!()] #' * [`!=`][!=()] @@ -179,13 +179,15 @@ #' * [`trunc()`][base::trunc()] #' #' ## bit64 -#' +#' #' * [`as.integer64()`][bit64::as.integer64()] #' * [`is.integer64()`][bit64::is.integer64()] #' #' ## dplyr -#' -#' * [`across()`][dplyr::across()]: only supported inside `mutate()`, `summarize()`, and `arrange()`; purrr-style lambda functions and use of `where()` selection helper not yet supported +#' +#' * [`across()`][dplyr::across()]: supported inside `mutate()`, `summarize()`, `group_by()`, and `arrange()`; +#' purrr-style lambda functions +#' and use of `where()` selection helper not yet supported #' * [`between()`][dplyr::between()] #' * [`case_when()`][dplyr::case_when()] #' * [`coalesce()`][dplyr::coalesce()] @@ -195,7 +197,7 @@ #' * [`n_distinct()`][dplyr::n_distinct()] #' #' ## lubridate -#' +#' #' * [`am()`][lubridate::am()] #' * [`as_date()`][lubridate::as_date()] #' * [`as_datetime()`][lubridate::as_datetime()] @@ -270,11 +272,11 @@ #' * [`yq()`][lubridate::yq()] #' #' ## methods -#' +#' #' * [`is()`][methods::is()] #' #' ## rlang -#' +#' #' * [`is_character()`][rlang::is_character()] #' * [`is_double()`][rlang::is_double()] #' * [`is_integer()`][rlang::is_integer()] @@ -282,18 +284,18 @@ #' * [`is_logical()`][rlang::is_logical()] #' #' ## stats -#' +#' #' * [`median()`][stats::median()] #' * [`quantile()`][stats::quantile()] #' * [`sd()`][stats::sd()] #' * [`var()`][stats::var()] #' #' ## stringi -#' +#' #' * [`stri_reverse()`][stringi::stri_reverse()] #' #' ## stringr -#' +#' #' * [`str_c()`][stringr::str_c()]: the `collapse` argument is not yet supported #' * [`str_count()`][stringr::str_count()] #' * [`str_detect()`][stringr::str_detect()] @@ -313,11 +315,11 @@ #' * [`str_trim()`][stringr::str_trim()] #' #' ## tibble -#' +#' #' * [`tibble()`][tibble::tibble()] #' #' ## tidyselect -#' +#' #' * [`all_of()`][tidyselect::all_of()] #' * [`contains()`][tidyselect::contains()] #' * [`ends_with()`][tidyselect::ends_with()] diff --git a/r/R/dplyr.R b/r/R/dplyr.R index 86132d8ae4aed..a96678f9757aa 100644 --- a/r/R/dplyr.R +++ b/r/R/dplyr.R @@ -189,7 +189,6 @@ dim.arrow_dplyr_query <- function(x) { #' @export unique.arrow_dplyr_query <- function(x, incomparables = FALSE, fromLast = FALSE, ...) { - if (isTRUE(incomparables)) { arrow_not_supported("`unique()` with `incomparables = TRUE`") } @@ -262,7 +261,7 @@ tail.arrow_dplyr_query <- function(x, n = 6L, ...) { #' mtcars %>% #' arrow_table() %>% #' filter(mpg > 20) %>% -#' mutate(x = gear/carb) %>% +#' mutate(x = gear / carb) %>% #' show_exec_plan() show_exec_plan <- function(x) { adq <- as_adq(x) diff --git a/r/data-raw/docgen.R b/r/data-raw/docgen.R index ef39bec272f53..9f839cfd1235e 100644 --- a/r/data-raw/docgen.R +++ b/r/data-raw/docgen.R @@ -116,8 +116,7 @@ render_pkg <- function(df, pkg) { pull() # Add header bullets <- c( - paste("##", pkg), - "", + paste0("## ", pkg, "\n#'"), bullets ) paste("#'", bullets, collapse = "\n") @@ -129,10 +128,11 @@ docs <- arrow:::.cache$docs # across() is handled by manipulating the quosures, not by nse_funcs docs[["dplyr::across"]] <- c( - # TODO(ARROW-17387, ARROW-17389, ARROW-17390) - "only supported inside `mutate()`, `summarize()`, and `arrange()`;", - # TODO(ARROW-17366) + # TODO(ARROW-17387, ARROW-17389, ARROW-17390): other verbs + "supported inside `mutate()`, `summarize()`, `group_by()`, and `arrange()`;", + # TODO(ARROW-17366): do ~ "purrr-style lambda functions", + # TODO(ARROW-17384): implement where "and use of `where()` selection helper not yet supported" ) # desc() is a special helper handled inside of arrange() @@ -154,7 +154,7 @@ fun_df <- tibble::tibble( # We will list operators under "base" (everything else must be pkg::fun) pkg = if_else(has_pkg, pkg, "base"), # Flatten notes to a single string - notes = map_chr(notes, ~ paste(., collapse = " ")) + notes = map_chr(notes, ~ paste(., collapse = "\n#' ")) ) %>% arrange(pkg, fun) diff --git a/r/man/acero.Rd b/r/man/acero.Rd index 5b5920f386e13..5d4859edcb511 100644 --- a/r/man/acero.Rd +++ b/r/man/acero.Rd @@ -175,7 +175,9 @@ as \code{arrow_ascii_is_decimal}. \subsection{dplyr}{ \itemize{ -\item \code{\link[dplyr:across]{across()}}: only supported inside \code{mutate()}, \code{summarize()}, and \code{arrange()}; purrr-style lambda functions and use of \code{where()} selection helper not yet supported +\item \code{\link[dplyr:across]{across()}}: supported inside \code{mutate()}, \code{summarize()}, \code{group_by()}, and \code{arrange()}; +purrr-style lambda functions +and use of \code{where()} selection helper not yet supported \item \code{\link[dplyr:between]{between()}} \item \code{\link[dplyr:case_when]{case_when()}} \item \code{\link[dplyr:coalesce]{coalesce()}} diff --git a/r/man/show_exec_plan.Rd b/r/man/show_exec_plan.Rd index c020838b2edf2..d6eb2298f223d 100644 --- a/r/man/show_exec_plan.Rd +++ b/r/man/show_exec_plan.Rd @@ -25,7 +25,7 @@ library(dplyr) mtcars \%>\% arrow_table() \%>\% filter(mpg > 20) \%>\% - mutate(x = gear/carb) \%>\% + mutate(x = gear / carb) \%>\% show_exec_plan() \dontshow{\}) # examplesIf} } diff --git a/r/tests/testthat/test-Table.R b/r/tests/testthat/test-Table.R index bafd183108ae9..d281894382339 100644 --- a/r/tests/testthat/test-Table.R +++ b/r/tests/testthat/test-Table.R @@ -692,5 +692,4 @@ test_that("num_rows method not susceptible to integer overflow", { expect_type(big_table$num_rows, "double") expect_identical(big_string_array$data()$buffers[[3]]$size, 2148007936) - }) diff --git a/r/tests/testthat/test-compute.R b/r/tests/testthat/test-compute.R index 11c37519ae5eb..882eea03e52b6 100644 --- a/r/tests/testthat/test-compute.R +++ b/r/tests/testthat/test-compute.R @@ -273,7 +273,7 @@ test_that("nested exec plans can contain user-defined functions", { on.exit(unregister_binding("times_32", update_cache = TRUE)) stream_plan_with_udf <- function() { - record_batch(a = 1:1000) %>% + record_batch(a = 1:1000) %>% dplyr::mutate(b = times_32(a)) %>% as_record_batch_reader() %>% as_arrow_table() diff --git a/r/tests/testthat/test-dataset-dplyr.R b/r/tests/testthat/test-dataset-dplyr.R index b09b549d5905e..f3ec858c6ce1c 100644 --- a/r/tests/testthat/test-dataset-dplyr.R +++ b/r/tests/testthat/test-dataset-dplyr.R @@ -356,9 +356,9 @@ test_that("show_exec_plan(), show_query() and explain() with datasets", { ds %>% show_exec_plan(), regexp = paste0( - "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan - "ProjectNode.*", # output columns - "SourceNode" # entry point + "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan + "ProjectNode.*", # output columns + "SourceNode" # entry point ) ) @@ -369,11 +369,11 @@ test_that("show_exec_plan(), show_query() and explain() with datasets", { filter(integer > 6L & part == 1) %>% show_exec_plan(), regexp = paste0( - "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan - "ProjectNode.*", # output columns - "FilterNode.*", # filter node - "int > 6.*cast.*", # filtering expressions + auto-casting of part - "SourceNode" # entry point + "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan + "ProjectNode.*", # output columns + "FilterNode.*", # filter node + "int > 6.*cast.*", # filtering expressions + auto-casting of part + "SourceNode" # entry point ) ) @@ -384,13 +384,13 @@ test_that("show_exec_plan(), show_query() and explain() with datasets", { summarise(avg = mean(int)) %>% show_exec_plan(), regexp = paste0( - "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan - "ProjectNode.*", # output columns - "GroupByNode.*", # group by node - "keys=.*part.*", # key for aggregations - "aggregates=.*hash_mean.*", # aggregations - "ProjectNode.*", # input columns - "SourceNode" # entry point + "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan + "ProjectNode.*", # output columns + "GroupByNode.*", # group by node + "keys=.*part.*", # key for aggregations + "aggregates=.*hash_mean.*", # aggregations + "ProjectNode.*", # input columns + "SourceNode" # entry point ) ) @@ -401,12 +401,12 @@ test_that("show_exec_plan(), show_query() and explain() with datasets", { arrange(chr) %>% show_exec_plan(), regexp = paste0( - "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan + "ExecPlan with .* nodes:.*", # boiler plate for ExecPlan "OrderBySinkNode.*chr.*ASC.*", # arrange goes via the OrderBy sink node - "ProjectNode.*", # output columns - "FilterNode.*", # filter node - "filter=lgl.*", # filtering expression - "SourceNode" # entry point + "ProjectNode.*", # output columns + "FilterNode.*", # filter node + "filter=lgl.*", # filtering expression + "SourceNode" # entry point ) ) diff --git a/r/tests/testthat/test-dataset.R b/r/tests/testthat/test-dataset.R index d9512ef94f3d7..bf38aaec3f2a8 100644 --- a/r/tests/testthat/test-dataset.R +++ b/r/tests/testthat/test-dataset.R @@ -692,7 +692,7 @@ test_that("map_batches", { test_that("map_batches with explicit schema", { fun_with_dots <- function(batch, first_col, first_col_val) { record_batch( - !! first_col := first_col_val, + !!first_col := first_col_val, b = batch$a$cast(float64()) ) } @@ -736,7 +736,7 @@ test_that("map_batches with explicit schema", { test_that("map_batches without explicit schema", { fun_with_dots <- function(batch, first_col, first_col_val) { record_batch( - !! first_col := first_col_val, + !!first_col := first_col_val, b = batch$a$cast(float64()) ) } diff --git a/r/tests/testthat/test-dplyr-across.R b/r/tests/testthat/test-dplyr-across.R index 8945c2a5f3ba8..cc419dbbe5413 100644 --- a/r/tests/testthat/test-dplyr-across.R +++ b/r/tests/testthat/test-dplyr-across.R @@ -222,5 +222,4 @@ test_that("expand_across correctly expands quosures", { regexp = "`.names` specification must produce (number of columns * number of functions) names.", fixed = TRUE ) - }) diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R b/r/tests/testthat/test-dplyr-funcs-datetime.R index b9ba877d6f647..b8f8da11ccc1d 100644 --- a/r/tests/testthat/test-dplyr-funcs-datetime.R +++ b/r/tests/testthat/test-dplyr-funcs-datetime.R @@ -186,7 +186,6 @@ test_that("strptime", { collect(), tibble::tibble(string_1 = c("2022-02-11-12:23:45", NA)) ) - }) test_that("strptime works for individual formats", { @@ -200,21 +199,21 @@ test_that("strptime works for individual formats", { expect_equal( strptime_test_df %>% arrow_table() %>% - mutate( - parsed_H = strptime(string_H, format = "%Y-%m-%d-%H"), - parsed_I = strptime(string_I, format = "%Y-%m-%d-%I"), - parsed_j = strptime(string_j, format = "%Y-%m-%d-%j"), - parsed_M = strptime(string_M, format = "%Y-%m-%d-%M"), - parsed_S = strptime(string_S, format = "%Y-%m-%d-%S"), - parsed_U = strptime(string_U, format = "%Y-%m-%d-%U"), - parsed_w = strptime(string_w, format = "%Y-%m-%d-%w"), - parsed_W = strptime(string_W, format = "%Y-%m-%d-%W"), - parsed_y = strptime(string_y, format = "%y-%m-%d"), - parsed_Y = strptime(string_Y, format = "%Y-%m-%d"), - parsed_R = strptime(string_R, format = "%Y-%m-%d-%R"), - parsed_T = strptime(string_T, format = "%Y-%m-%d-%T") - ) %>% - collect(), + mutate( + parsed_H = strptime(string_H, format = "%Y-%m-%d-%H"), + parsed_I = strptime(string_I, format = "%Y-%m-%d-%I"), + parsed_j = strptime(string_j, format = "%Y-%m-%d-%j"), + parsed_M = strptime(string_M, format = "%Y-%m-%d-%M"), + parsed_S = strptime(string_S, format = "%Y-%m-%d-%S"), + parsed_U = strptime(string_U, format = "%Y-%m-%d-%U"), + parsed_w = strptime(string_w, format = "%Y-%m-%d-%w"), + parsed_W = strptime(string_W, format = "%Y-%m-%d-%W"), + parsed_y = strptime(string_y, format = "%y-%m-%d"), + parsed_Y = strptime(string_Y, format = "%Y-%m-%d"), + parsed_R = strptime(string_R, format = "%Y-%m-%d-%R"), + parsed_T = strptime(string_T, format = "%Y-%m-%d-%T") + ) %>% + collect(), strptime_test_df %>% mutate( parsed_H = as.POSIXct(strptime(string_H, format = "%Y-%m-%d-%H")), @@ -238,15 +237,15 @@ test_that("strptime works for individual formats", { expect_equal( strptime_test_df %>% arrow_table() %>% - mutate( - parsed_a = strptime(string_a, format = "%Y-%m-%d-%a"), - parsed_A = strptime(string_A, format = "%Y-%m-%d-%A"), - parsed_b = strptime(string_b, format = "%Y-%m-%d-%b"), - parsed_B = strptime(string_B, format = "%Y-%m-%d-%B"), - parsed_p = strptime(string_p, format = "%Y-%m-%d-%p"), - parsed_r = strptime(string_r, format = "%Y-%m-%d-%r") - ) %>% - collect(), + mutate( + parsed_a = strptime(string_a, format = "%Y-%m-%d-%a"), + parsed_A = strptime(string_A, format = "%Y-%m-%d-%A"), + parsed_b = strptime(string_b, format = "%Y-%m-%d-%b"), + parsed_B = strptime(string_B, format = "%Y-%m-%d-%B"), + parsed_p = strptime(string_p, format = "%Y-%m-%d-%p"), + parsed_r = strptime(string_r, format = "%Y-%m-%d-%r") + ) %>% + collect(), strptime_test_df %>% mutate( parsed_a = as.POSIXct(strptime(string_a, format = "%Y-%m-%d-%a")), @@ -258,7 +257,6 @@ test_that("strptime works for individual formats", { ) %>% collect() ) - }) test_that("timestamp round trip correctly via strftime and strptime", { @@ -297,8 +295,8 @@ test_that("timestamp round trip correctly via strftime and strptime", { expect_equal( test_df %>% arrow_table() %>% - mutate(!!fmt := strptime(x, format = fmt)) %>% - collect(), + mutate(!!fmt := strptime(x, format = fmt)) %>% + collect(), test_df %>% mutate(!!fmt := as.POSIXct(strptime(x, format = fmt))) %>% collect() @@ -312,14 +310,13 @@ test_that("timestamp round trip correctly via strftime and strptime", { expect_equal( test_df %>% arrow_table() %>% - mutate(!!fmt := strptime(x, format = fmt2)) %>% - collect(), + mutate(!!fmt := strptime(x, format = fmt2)) %>% + collect(), test_df %>% mutate(!!fmt := as.POSIXct(strptime(x, format = fmt2))) %>% collect() ) } - }) test_that("strptime returns NA when format doesn't match the data", { @@ -994,8 +991,8 @@ test_that("extract qday from date", { compare_dplyr_binding( .input %>% - mutate(y = qday(as.Date("2022-06-29"))) %>% - collect(), + mutate(y = qday(as.Date("2022-06-29"))) %>% + collect(), test_df ) }) @@ -2299,7 +2296,6 @@ test_that("parse_date_time's other formats", { tibble::tibble(string_1 = c("2022-Feb-11-12:23:45", NA)) ) } - }) test_that("lubridate's fast_strptime", { @@ -2835,7 +2831,6 @@ test_that("parse_date_time with `exact = TRUE`, and with regular R objects", { }) test_that("build_formats() and build_format_from_order()", { - ymd_formats <- c( "%y-%m-%d", "%Y-%m-%d", "%y-%B-%d", "%Y-%B-%d", "%y-%b-%d", "%Y-%b-%d", "%y%m%d", "%Y%m%d", "%y%B%d", "%Y%B%d", "%y%b%d", "%Y%b%d" @@ -3027,7 +3022,7 @@ boundary_times <- tibble::tibble( "2022-03-10 00:00:01", # boundary for second, millisecond "2022-03-10 00:01:00", # boundary for second, millisecond, minute "2022-03-10 01:00:00", # boundary for second, millisecond, minute, hour - "2022-01-01 00:00:00" # boundary for year + "2022-01-01 00:00:00" # boundary for year ), tz = "UTC", format = "%F %T")), date = as.Date(datetime) ) @@ -3053,14 +3048,13 @@ datestrings <- c( ) tz_times <- tibble::tibble( utc_time = as.POSIXct(datestrings, tz = "UTC"), - syd_time = as.POSIXct(datestrings, tz = "Australia/Sydney"), # UTC +10 (UTC +11 with DST) + syd_time = as.POSIXct(datestrings, tz = "Australia/Sydney"), # UTC +10 (UTC +11 with DST) adl_time = as.POSIXct(datestrings, tz = "Australia/Adelaide"), # UTC +9:30 (UTC +10:30 with DST) - mar_time = as.POSIXct(datestrings, tz = "Pacific/Marquesas"), # UTC -9:30 (no DST) - kat_time = as.POSIXct(datestrings, tz = "Asia/Kathmandu") # UTC +5:45 (no DST) + mar_time = as.POSIXct(datestrings, tz = "Pacific/Marquesas"), # UTC -9:30 (no DST) + kat_time = as.POSIXct(datestrings, tz = "Asia/Kathmandu") # UTC +5:45 (no DST) ) test_that("timestamp round/floor/ceiling works for a minimal test", { - compare_dplyr_binding( .input %>% mutate( @@ -3103,7 +3097,6 @@ test_that("timestamp round/floor/ceiling accepts period unit abbreviation", { }) test_that("temporal round/floor/ceiling accepts periods with multiple units", { - check_multiple_unit_period <- function(unit, multiplier) { unit_string <- paste(multiplier, unit) compare_dplyr_binding( @@ -3152,7 +3145,6 @@ check_date_rounding <- function(data, unit, lubridate_unit = unit, ...) { } check_timestamp_rounding <- function(data, unit, lubridate_unit = unit, ...) { - expect_equal( data %>% arrow_table() %>% @@ -3173,16 +3165,13 @@ check_timestamp_rounding <- function(data, unit, lubridate_unit = unit, ...) { } test_that("date round/floor/ceil works for units of 1 day or less", { - test_df %>% check_date_rounding("1 millisecond", lubridate_unit = ".001 second") test_df %>% check_date_rounding("1 day") test_df %>% check_date_rounding("1 second") test_df %>% check_date_rounding("1 hour") - }) test_that("timestamp round/floor/ceil works for units of 1 day or less", { - test_df %>% check_timestamp_rounding("second") test_df %>% check_timestamp_rounding("minute") test_df %>% check_timestamp_rounding("hour") @@ -3195,15 +3184,12 @@ test_that("timestamp round/floor/ceil works for units of 1 day or less", { test_df %>% check_timestamp_rounding("1 millisecond", lubridate_unit = ".001 second") test_df %>% check_timestamp_rounding("1 microsecond", lubridate_unit = ".000001 second") test_df %>% check_timestamp_rounding("1 nanosecond", lubridate_unit = ".000000001 second") - }) test_that("timestamp round/floor/ceil works for units: month/quarter/year", { - year_of_dates %>% check_timestamp_rounding("month", ignore_attr = TRUE) year_of_dates %>% check_timestamp_rounding("quarter", ignore_attr = TRUE) year_of_dates %>% check_timestamp_rounding("year", ignore_attr = TRUE) - }) # check helper invoked when we need to avoid the lubridate rounding bug @@ -3249,7 +3235,6 @@ test_that("date round/floor/ceil works for units: month/quarter/year", { check_date_rounding_1051_bypass(year_of_dates, "month", ignore_attr = TRUE) check_date_rounding_1051_bypass(year_of_dates, "quarter", ignore_attr = TRUE) check_date_rounding_1051_bypass(year_of_dates, "year", ignore_attr = TRUE) - }) check_date_week_rounding <- function(data, week_start, ignore_attr = TRUE, ...) { @@ -3289,20 +3274,16 @@ check_timestamp_week_rounding <- function(data, week_start, ignore_attr = TRUE, } test_that("timestamp round/floor/ceil works for week units (standard week_start)", { - fortnight %>% check_timestamp_week_rounding(week_start = 1) # Monday fortnight %>% check_timestamp_week_rounding(week_start = 7) # Sunday - }) test_that("timestamp round/floor/ceil works for week units (non-standard week_start)", { - fortnight %>% check_timestamp_week_rounding(week_start = 2) # Tuesday fortnight %>% check_timestamp_week_rounding(week_start = 3) # Wednesday fortnight %>% check_timestamp_week_rounding(week_start = 4) # Thursday fortnight %>% check_timestamp_week_rounding(week_start = 5) # Friday fortnight %>% check_timestamp_week_rounding(week_start = 6) # Saturday - }) check_date_week_rounding <- function(data, week_start, ignore_attr = TRUE, ...) { @@ -3337,20 +3318,16 @@ check_date_week_rounding <- function(data, week_start, ignore_attr = TRUE, ...) } test_that("date round/floor/ceil works for week units (standard week_start)", { - check_date_week_rounding(fortnight, week_start = 1) # Monday check_date_week_rounding(fortnight, week_start = 7) # Sunday - }) test_that("date round/floor/ceil works for week units (non-standard week_start)", { - check_date_week_rounding(fortnight, week_start = 2) # Tuesday check_date_week_rounding(fortnight, week_start = 3) # Wednesday check_date_week_rounding(fortnight, week_start = 4) # Thursday check_date_week_rounding(fortnight, week_start = 5) # Friday check_date_week_rounding(fortnight, week_start = 6) # Saturday - }) # Test helper used to check that the change_on_boundary argument to @@ -3389,8 +3366,6 @@ check_boundary_with_unit <- function(unit, ...) { ), ... ) - - } test_that("ceiling_date() applies change_on_boundary correctly", { @@ -3405,7 +3380,6 @@ test_that("ceiling_date() applies change_on_boundary correctly", { # exceeded. Checks that arrow mimics this behaviour and throws an identically # worded error message test_that("temporal round/floor/ceil period unit maxima are enforced", { - expect_error( call_binding("round_date", Expression$scalar(Sys.time()), "61 seconds"), "Rounding with second > 60 is not supported" @@ -3422,7 +3396,6 @@ test_that("temporal round/floor/ceil period unit maxima are enforced", { call_binding("round_date", Expression$scalar(Sys.Date()), "25 hours"), "Rounding with hour > 24 is not supported" ) - }) # one method to test that temporal rounding takes place in local time is to @@ -3464,7 +3437,6 @@ check_timezone_rounding_vs_lubridate <- function(data, unit) { collect(), data ) - } # another method to check that temporal rounding takes place in local @@ -3474,7 +3446,6 @@ check_timezone_rounding_vs_lubridate <- function(data, unit) { # for UTC test. this test isn't useful for subsecond resolution but avoids # dependency on lubridate check_timezone_rounding_for_consistency <- function(data, unit) { - shifted_times <- data %>% arrow_table() %>% mutate( @@ -3498,11 +3469,11 @@ check_timezone_rounding_for_consistency <- function(data, unit) { compare_local_times <- function(time1, time2) { all(year(time1) == year(time1) & - month(time1) == month(time2) & - day(time1) == day(time2) & - hour(time1) == hour(time2) & - minute(time1) == minute(time2) & - second(time1) == second(time1)) + month(time1) == month(time2) & + day(time1) == day(time2) & + hour(time1) == hour(time2) & + minute(time1) == minute(time2) & + second(time1) == second(time1)) } base <- shifted_times$utc_rounded @@ -3525,7 +3496,6 @@ check_timezone_rounding_for_consistency <- function(data, unit) { } test_that("timestamp rounding takes place in local time", { - tz_times %>% check_timezone_rounding_vs_lubridate(".001 second") tz_times %>% check_timezone_rounding_vs_lubridate("second") tz_times %>% check_timezone_rounding_vs_lubridate("minute") @@ -3556,5 +3526,4 @@ test_that("timestamp rounding takes place in local time", { tz_times %>% check_timezone_rounding_for_consistency("13 hours") tz_times %>% check_timezone_rounding_for_consistency("13 months") tz_times %>% check_timezone_rounding_for_consistency("13 years") - }) diff --git a/r/tests/testthat/test-dplyr-funcs-math.R b/r/tests/testthat/test-dplyr-funcs-math.R index b9a6a3707d42d..66b3a510f9c39 100644 --- a/r/tests/testthat/test-dplyr-funcs-math.R +++ b/r/tests/testthat/test-dplyr-funcs-math.R @@ -25,7 +25,8 @@ test_that("abs()", { .input %>% transmute( abs = abs(x), - abs2 = base::abs(x)) %>% + abs2 = base::abs(x) + ) %>% collect(), df ) diff --git a/r/tests/testthat/test-dplyr-funcs-string.R b/r/tests/testthat/test-dplyr-funcs-string.R index 229347372aed3..57f8532ea8310 100644 --- a/r/tests/testthat/test-dplyr-funcs-string.R +++ b/r/tests/testthat/test-dplyr-funcs-string.R @@ -61,7 +61,8 @@ test_that("paste, paste0, and str_c", { .input %>% transmute( a = paste0(v, w), - a2 = base::paste0(v, w)) %>% + a2 = base::paste0(v, w) + ) %>% collect(), df ) diff --git a/r/tests/testthat/test-dplyr-funcs-type.R b/r/tests/testthat/test-dplyr-funcs-type.R index 285d86520f3c2..ccf16dd4db47b 100644 --- a/r/tests/testthat/test-dplyr-funcs-type.R +++ b/r/tests/testthat/test-dplyr-funcs-type.R @@ -289,7 +289,7 @@ test_that("type checks with is() giving Arrow types", { str_is_dec256 = is(str, decimal256(3, 2)), str_is_i64 = is(str, float64()), str_is_str = is(str, string()) - ) %>% + ) %>% collect() %>% t() %>% as.vector(), diff --git a/r/tools/winlibs.R b/r/tools/winlibs.R index 5aeea2e417e30..165c98da5ea95 100644 --- a/r/tools/winlibs.R +++ b/r/tools/winlibs.R @@ -48,7 +48,7 @@ if (!file.exists(sprintf("windows/arrow-%s/include/arrow/api.h", VERSION))) { rwinlib <- "https://github.com/rwinlib/arrow/archive/v%s.zip" dev_version <- package_version(VERSION)[1, 4] - + # Small dev versions are added for R-only changes during CRAN submission. if (is.na(dev_version) || dev_version < 100) { VERSION <- package_version(VERSION)[1, 1:3]