diff options
author | Felix Cheung <felixcheung_m@hotmail.com> | 2016-06-17 15:56:03 -0700 |
---|---|---|
committer | Shivaram Venkataraman <shivaram@cs.berkeley.edu> | 2016-06-17 15:56:03 -0700 |
commit | ef3cc4fc096e831823d62af4fd2a12ae88d434b4 (patch) | |
tree | 27bf03489f38ae686c1f88eb4d17db9c7f9173d4 /R/pkg/inst/tests/testthat/test_sparkSQL.R | |
parent | 1a65e62a7ff961ba140b9189e5335736334edbd6 (diff) | |
download | spark-ef3cc4fc096e831823d62af4fd2a12ae88d434b4.tar.gz spark-ef3cc4fc096e831823d62af4fd2a12ae88d434b4.tar.bz2 spark-ef3cc4fc096e831823d62af4fd2a12ae88d434b4.zip |
[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 <felixcheung_m@hotmail.com>
Closes #13722 from felixcheung/rregistertemptable.
Diffstat (limited to 'R/pkg/inst/tests/testthat/test_sparkSQL.R')
-rw-r--r-- | R/pkg/inst/tests/testthat/test_sparkSQL.R | 30 |
1 files changed, 19 insertions, 11 deletions
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") |