Skip to content

Commit c9df05f

Browse files
committed
Fix data descriptor Spark tests
1 parent 441fc79 commit c9df05f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

tests/testthat/test_descriptors.R

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -198,29 +198,30 @@ test_that("spark descriptor", {
198198
npk_descr <- copy_to(sc, npk[, 1:4], "npk_descr", overwrite = TRUE)
199199
hpc_descr <- copy_to(sc, hpc, "hpc_descr", overwrite = TRUE)
200200

201-
# spark does not allow .x, .y, .dat
201+
# spark does not allow .x, .y, .dat; spark handles factors differently
202202
template2 <- purrr::partial(template, x = NULL, y = NULL, dat = NULL)
203203
eval_descrs2 <- purrr::partial(eval_descrs, not = c(".x", ".y", ".dat"))
204+
class_tab2 <- table(as.character(hpc$class), dnn = NULL)
204205

205206
expect_equal(
206-
template2(5, 4, 150, NA, 1),
207-
eval_descrs2(get_descr_form(Sepal_Width ~ ., data = hpc_descr))
207+
template2(6, 4, 150, NA, 1),
208+
eval_descrs2(get_descr_form(compounds ~ ., data = hpc_descr))
208209
)
209210
expect_equal(
210-
template2(2, 1, 150, NA, 1),
211-
eval_descrs2(get_descr_form(Sepal_Width ~ class, data = hpc_descr))
211+
template2(3, 1, 150, NA, 1),
212+
eval_descrs2(get_descr_form(compounds ~ class, data = hpc_descr))
212213
)
213214
expect_equal(
214215
template2(1, 1, 150, NA, 0),
215-
eval_descrs2(get_descr_form(Sepal_Width ~ Sepal_Length, data = hpc_descr))
216+
eval_descrs2(get_descr_form(compounds ~ input_fields, data = hpc_descr))
216217
)
217218
expect_equivalent(
218-
template2(4, 4, 150, class_tab, 0),
219+
template2(4, 4, 150, class_tab2, 0),
219220
eval_descrs2(get_descr_form(class ~ ., data = hpc_descr))
220221
)
221222
expect_equal(
222-
template2(1, 1, 150, class_tab, 0),
223-
eval_descrs2(get_descr_form(class ~ Sepal_Length, data = hpc_descr))
223+
template2(1, 1, 150, class_tab2, 0),
224+
eval_descrs2(get_descr_form(class ~ input_fields, data = hpc_descr))
224225
)
225226
expect_equivalent(
226227
template2(7, 3, 24, rev(table(npk$K, dnn = NULL)), 3),

0 commit comments

Comments
 (0)