Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions R/pkg/inst/tests/test_sparkSQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ test_that("create DataFrame from list or data.frame", {
df <- createDataFrame(sqlContext, l, c("a", "b"))
expect_equal(columns(df), c("a", "b"))

l <- list(list(a=1, b=2), list(a=3, b=4))
l <- list(list(a = 1, b = 2), list(a = 3, b = 4))
df <- createDataFrame(sqlContext, l)
expect_equal(columns(df), c("a", "b"))

Expand Down Expand Up @@ -292,11 +292,15 @@ test_that("create DataFrame with complex types", {
})

test_that("create DataFrame from a data.frame with complex types", {
ldf <- data.frame(row.names=1:2)
ldf <- data.frame(row.names = 1:2)
ldf$a_list <- list(list(1, 2), list(3, 4))
ldf$an_envir <- c(as.environment(list(a = 1, b = 2)), as.environment(list(c = 3)))

sdf <- createDataFrame(sqlContext, ldf)
collected <- collect(sdf)

expect_equivalent(ldf, collect(sdf))
expect_identical(ldf[, 1, FALSE], collected[, 1, FALSE])
expect_equal(ldf$an_envir, collected$an_envir)
})

# For test map type and struct type in DataFrame
Expand Down