Skip to content

Commit 6f9159d

Browse files
committed
Add another test case.
1 parent 8db3244 commit 6f9159d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

R/pkg/inst/tests/test_sparkSQL.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ test_that("create DataFrame from RDD", {
116116
expect_equal(count(df), 3)
117117
expect_equal(columns(df), c("name", "age", "height"))
118118
expect_equal(dtypes(df), list(c("name", "string"), c("age", "double"), c("height", "double")))
119+
120+
hiveCtx <- tryCatch({
121+
newJObject("org.apache.spark.sql.hive.test.TestHiveContext", ssc)
122+
}, error = function(err) {
123+
skip("Hive is not build with SparkSQL, skipped")
124+
})
125+
sql(hiveCtx, "CREATE TABLE people (name string, age double, height float) row format delimited fields terminated by ','")
126+
insertInto(df, "people")
127+
expect_equal(sql(hiveCtx, "SELECT age from people"), c(19, 23, 18))
128+
expect_equal(sql(hiveCtx, "SELECT height from people"), c(164.10, 181.4, 173.7))
119129
})
120130

121131
test_that("convert NAs to null type in DataFrames", {

0 commit comments

Comments
 (0)