Skip to content

Commit 1d93304

Browse files
committed
code review
1 parent 5247ab5 commit 1d93304

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

R/pkg/tests/fulltests/test_sparkSQL.R

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,29 +2483,22 @@ test_that("union(), unionByName(), rbind(), except(), and intersect() on a DataF
24832483
})
24842484

24852485
test_that("intersectAll() and exceptAll()", {
2486-
df1 <- createDataFrame(
2487-
list(list("a", 1),
2488-
list("a", 1),
2489-
list("a", 1),
2490-
list("a", 1),
2491-
list("b", 3),
2492-
list("c", 4)),
2493-
schema = c("a", "b"))
2494-
df2 <- createDataFrame(
2495-
list(list("a", 1), list("a", 1), list("b", 3)),
2496-
schema = c("a", "b"))
2497-
intersect_all_expected <- data.frame("a" = c("a", "a", "b"), "b" = c(1, 1, 3),
2486+
df1 <- createDataFrame(list(list("a", 1), list("a", 1), list("a", 1),
2487+
list("a", 1), list("b", 3), list("c", 4)),
2488+
schema = c("a", "b"))
2489+
df2 <- createDataFrame(list(list("a", 1), list("a", 1), list("b", 3)), schema = c("a", "b"))
2490+
intersectAllExpected <- data.frame("a" = c("a", "a", "b"), "b" = c(1, 1, 3),
24982491
stringsAsFactors = FALSE)
2499-
except_all_expected <- data.frame("a" = c("a", "a", "c"), "b" = c(1, 1, 4),
2492+
exceptAllExpected <- data.frame("a" = c("a", "a", "c"), "b" = c(1, 1, 4),
25002493
stringsAsFactors = FALSE)
2501-
intersect_all_df <- arrange(intersectAll(df1, df2), df1$a)
2502-
expect_is(intersect_all_df, "SparkDataFrame")
2503-
except_all_df <- arrange(exceptAll(df1, df2), df1$a)
2504-
expect_is(except_all_df, "SparkDataFrame")
2505-
intersect_all_actual <- collect(intersect_all_df)
2506-
expect_identical(intersect_all_actual, intersect_all_expected)
2507-
except_all_actual <- collect(except_all_df)
2508-
expect_identical(except_all_actual, except_all_expected)
2494+
intersectAllDf <- arrange(intersectAll(df1, df2), df1$a)
2495+
expect_is(intersectAllDf, "SparkDataFrame")
2496+
exceptAllDf <- arrange(exceptAll(df1, df2), df1$a)
2497+
expect_is(exceptAllDf, "SparkDataFrame")
2498+
intersectAllActual <- collect(intersectAllDf)
2499+
expect_identical(intersectAllActual, intersectAllExpected)
2500+
exceptAllActual <- collect(exceptAllDf)
2501+
expect_identical(exceptAllActual, exceptAllExpected)
25092502
})
25102503

25112504
test_that("withColumn() and withColumnRenamed()", {

0 commit comments

Comments
 (0)