aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests/testthat/test_sparkSQL.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/pkg/inst/tests/testthat/test_sparkSQL.R')
-rw-r--r--R/pkg/inst/tests/testthat/test_sparkSQL.R15
1 files changed, 8 insertions, 7 deletions
diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R
index 375cb6f588..d1ca3b726f 100644
--- a/R/pkg/inst/tests/testthat/test_sparkSQL.R
+++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R
@@ -445,7 +445,7 @@ test_that("jsonRDD() on a RDD with json string", {
test_that("test cache, uncache and clearCache", {
df <- read.json(jsonPath)
- registerTempTable(df, "table1")
+ createOrReplaceTempView(df, "table1")
cacheTable("table1")
uncacheTable("table1")
clearCache()
@@ -454,16 +454,17 @@ test_that("test cache, uncache and clearCache", {
test_that("test tableNames and tables", {
df <- read.json(jsonPath)
- registerTempTable(df, "table1")
+ createOrReplaceTempView(df, "table1")
expect_equal(length(tableNames()), 1)
df <- tables()
expect_equal(count(df), 1)
dropTempTable("table1")
})
-test_that("registerTempTable() results in a queryable table and sql() results in a new DataFrame", {
+test_that(
+ "createOrReplaceTempView() results in a queryable table and sql() results in a new DataFrame", {
df <- read.json(jsonPath)
- registerTempTable(df, "table1")
+ createOrReplaceTempView(df, "table1")
newdf <- sql("SELECT * FROM table1 where name = 'Michael'")
expect_is(newdf, "SparkDataFrame")
expect_equal(count(newdf), 1)
@@ -484,13 +485,13 @@ test_that("insertInto() on a registered table", {
write.df(df2, parquetPath2, "parquet", "overwrite")
dfParquet2 <- read.df(parquetPath2, "parquet")
- registerTempTable(dfParquet, "table1")
+ createOrReplaceTempView(dfParquet, "table1")
insertInto(dfParquet2, "table1")
expect_equal(count(sql("select * from table1")), 5)
expect_equal(first(sql("select * from table1 order by age"))$name, "Michael")
dropTempTable("table1")
- registerTempTable(dfParquet, "table1")
+ createOrReplaceTempView(dfParquet, "table1")
insertInto(dfParquet2, "table1", overwrite = TRUE)
expect_equal(count(sql("select * from table1")), 2)
expect_equal(first(sql("select * from table1 order by age"))$name, "Bob")
@@ -502,7 +503,7 @@ test_that("insertInto() on a registered table", {
test_that("tableToDF() returns a new DataFrame", {
df <- read.json(jsonPath)
- registerTempTable(df, "table1")
+ createOrReplaceTempView(df, "table1")
tabledf <- tableToDF("table1")
expect_is(tabledf, "SparkDataFrame")
expect_equal(count(tabledf), 3)