From ef3cc4fc096e831823d62af4fd2a12ae88d434b4 Mon Sep 17 00:00:00 2001 From: Felix Cheung Date: Fri, 17 Jun 2016 15:56:03 -0700 Subject: [SPARK-15925][SPARKR] R DataFrame add back registerTempTable, add tests ## What changes were proposed in this pull request? Add registerTempTable to DataFrame with Deprecate ## How was this patch tested? unit tests shivaram liancheng Author: Felix Cheung Closes #13722 from felixcheung/rregistertemptable. --- R/pkg/inst/tests/testthat/test_sparkSQL.R | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'R/pkg/inst') diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R index 11d69366df..7aa03a9048 100644 --- a/R/pkg/inst/tests/testthat/test_sparkSQL.R +++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R @@ -443,22 +443,21 @@ test_that("jsonRDD() on a RDD with json string", { expect_equal(count(df), 6) }) -test_that("test cache, uncache and clearCache", { - df <- read.json(jsonPath) - createOrReplaceTempView(df, "table1") - cacheTable("table1") - uncacheTable("table1") - clearCache() - dropTempTable("table1") -}) - test_that("test tableNames and tables", { df <- read.json(jsonPath) createOrReplaceTempView(df, "table1") expect_equal(length(tableNames()), 1) - df <- tables() - expect_equal(count(df), 1) + tables <- tables() + expect_equal(count(tables), 1) + + suppressWarnings(registerTempTable(df, "table2")) + tables <- tables() + expect_equal(count(tables), 2) dropTempTable("table1") + dropTempTable("table2") + + tables <- tables() + expect_equal(count(tables), 0) }) test_that( @@ -471,6 +470,15 @@ test_that( dropTempTable("table1") }) +test_that("test cache, uncache and clearCache", { + df <- read.json(jsonPath) + createOrReplaceTempView(df, "table1") + cacheTable("table1") + uncacheTable("table1") + clearCache() + dropTempTable("table1") +}) + test_that("insertInto() on a registered table", { df <- read.df(jsonPath, "json") write.df(df, parquetPath, "parquet", "overwrite") -- cgit v1.2.3