aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests
diff options
context:
space:
mode:
authorfelixcheung <felixcheung_m@hotmail.com>2015-10-03 22:42:36 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-10-03 22:42:36 -0700
commit721e8b5f35b230ff426c1757a9bdc1399fb19afa (patch)
treee56ddb71163299a662b193425b2f67a8d154220b /R/pkg/inst/tests
parentae6570ec2bf937e28bd1e7bada7813ac56a7b79d (diff)
downloadspark-721e8b5f35b230ff426c1757a9bdc1399fb19afa.tar.gz
spark-721e8b5f35b230ff426c1757a9bdc1399fb19afa.tar.bz2
spark-721e8b5f35b230ff426c1757a9bdc1399fb19afa.zip
[SPARK-10904] [SPARKR] Fix to support `select(df, c("col1", "col2"))`
The fix is to coerce `c("a", "b")` into a list such that it could be serialized to call JVM with. Author: felixcheung <felixcheung_m@hotmail.com> Closes #8961 from felixcheung/rselect.
Diffstat (limited to 'R/pkg/inst/tests')
-rw-r--r--R/pkg/inst/tests/test_sparkSQL.R9
1 files changed, 8 insertions, 1 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index 8f85eecbc4..faf42b7182 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -673,6 +673,13 @@ test_that("select with column", {
expect_equal(columns(df3), c("x"))
expect_equal(count(df3), 3)
expect_equal(collect(select(df3, "x"))[[1, 1]], "x")
+
+ df4 <- select(df, c("name", "age"))
+ expect_equal(columns(df4), c("name", "age"))
+ expect_equal(count(df4), 3)
+
+ expect_error(select(df, c("name", "age"), "name"),
+ "To select multiple columns, use a character vector or list for col")
})
test_that("subsetting", {
@@ -1336,4 +1343,4 @@ test_that("Method as.data.frame as a synonym for collect()", {
unlink(parquetPath)
unlink(jsonPath)
-unlink(jsonPathNa) \ No newline at end of file
+unlink(jsonPathNa)