Skip to content

Commit f67095e

Browse files
committed
more fix to test
1 parent 90641a7 commit f67095e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

R/pkg/inst/tests/testthat/test_sparkSQL.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ markUtf8 <- function(s) {
3232
s
3333
}
3434

35-
setHiveContext <- function() {
35+
setHiveContext <- function(sc) {
3636
ssc <- callJMethod(sc, "sc")
3737
hiveCtx <- tryCatch({
3838
newJObject("org.apache.spark.sql.hive.test.TestHiveContext", ssc)
@@ -178,7 +178,7 @@ test_that("create DataFrame from RDD", {
178178
expect_equal(as.list(collect(where(df, df$name == "John"))),
179179
list(name = "John", age = 19L, height = 176.5))
180180

181-
setHiveContext()
181+
setHiveContext(sc)
182182
sql("CREATE TABLE people (name string, age double, height float)")
183183
df <- read.df(jsonPathNa, "json", schema)
184184
invisible(insertInto(df, "people"))
@@ -963,8 +963,7 @@ test_that("column calculation", {
963963
})
964964

965965
test_that("test HiveContext", {
966-
ssc <- callJMethod(sc, "sc")
967-
setHiveContext()
966+
setHiveContext(sc)
968967
df <- createExternalTable("json", jsonPath, "json")
969968
expect_is(df, "SparkDataFrame")
970969
expect_equal(count(df), 3)
@@ -2140,8 +2139,7 @@ test_that("repartition by columns on DataFrame", {
21402139
})
21412140

21422141
test_that("Window functions on a DataFrame", {
2143-
ssc <- callJMethod(sc, "sc")
2144-
setHiveContext()
2142+
setHiveContext(sc)
21452143
df <- createDataFrame(list(list(1L, "1"), list(2L, "2"), list(1L, "1"), list(2L, "2")),
21462144
schema = c("key", "value"))
21472145
ws <- orderBy(window.partitionBy("key"), "value")

0 commit comments

Comments
 (0)