From a3005101b99813bab59d7e936de2559e884b159a Mon Sep 17 00:00:00 2001 From: Edgar Ruiz Date: Fri, 2 Feb 2024 14:55:07 -0600 Subject: [PATCH] Accounts for new Spark dataframe header output, skips spark_apply() with barrier if < Spark 3.5 --- tests/testthat/_snaps/pivot-longer.md | 6 +++--- tests/testthat/test-pivot-longer.R | 3 ++- tests/testthat/test-sparklyr-spark-apply.R | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/testthat/_snaps/pivot-longer.md b/tests/testthat/_snaps/pivot-longer.md index 7c47f0d..775f2e5 100644 --- a/tests/testthat/_snaps/pivot-longer.md +++ b/tests/testthat/_snaps/pivot-longer.md @@ -1,10 +1,10 @@ # Pivot longer Code - tbl_pivot %>% tidyr::pivot_longer(-id, names_to = c(".value", "n"), names_sep = "_") + tbl_pivot %>% tidyr::pivot_longer(-id, names_to = c(".value", "n"), names_sep = "_") %>% + collect() Output - # Source: table [4 x 5] - # Database: spark_connection + # A tibble: 4 x 5 id n z y x 1 A 1 1 2 3 diff --git a/tests/testthat/test-pivot-longer.R b/tests/testthat/test-pivot-longer.R index 91f9937..31a049a 100644 --- a/tests/testthat/test-pivot-longer.R +++ b/tests/testthat/test-pivot-longer.R @@ -12,7 +12,8 @@ test_that("Pivot longer", { tidyr::pivot_longer( -id, names_to = c(".value", "n"), names_sep = "_" - ) + ) %>% + collect() ) }) diff --git a/tests/testthat/test-sparklyr-spark-apply.R b/tests/testthat/test-sparklyr-spark-apply.R index be14e26..3784239 100644 --- a/tests/testthat/test-sparklyr-spark-apply.R +++ b/tests/testthat/test-sparklyr-spark-apply.R @@ -4,6 +4,7 @@ test_that("spark_apply() works", { spark_apply(tbl_mtcars, nrow, group_by = "am", columns = "am double, x long"), "tbl_spark" ) + skip_spark_min_version(3.5) expect_s3_class( spark_apply(tbl_mtcars, function(x) x), "tbl_spark"