aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests/test_sparkSQL.R
diff options
context:
space:
mode:
authorSun Rui <rui.sun@intel.com>2015-11-18 08:41:45 -0800
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-11-18 08:41:45 -0800
commit224723e6a8b198ef45d6c5ca5d2f9c61188ada8f (patch)
treed5aa29ba83426848d73d9c0e68ef7762c2c252fa /R/pkg/inst/tests/test_sparkSQL.R
parenta97d6f3a5861e9f2bbe36957e3b39f835f3e214c (diff)
downloadspark-224723e6a8b198ef45d6c5ca5d2f9c61188ada8f.tar.gz
spark-224723e6a8b198ef45d6c5ca5d2f9c61188ada8f.tar.bz2
spark-224723e6a8b198ef45d6c5ca5d2f9c61188ada8f.zip
[SPARK-11773][SPARKR] Implement collection functions in SparkR.
Author: Sun Rui <rui.sun@intel.com> Closes #9764 from sun-rui/SPARK-11773.
Diffstat (limited to 'R/pkg/inst/tests/test_sparkSQL.R')
-rw-r--r--R/pkg/inst/tests/test_sparkSQL.R10
1 files changed, 10 insertions, 0 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index 87ab33f638..d9a94faff7 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -878,6 +878,16 @@ test_that("column functions", {
df4 <- createDataFrame(sqlContext, list(list(a = "010101")))
expect_equal(collect(select(df4, conv(df4$a, 2, 16)))[1, 1], "15")
+
+ # Test array_contains() and sort_array()
+ df <- createDataFrame(sqlContext, list(list(list(1L, 2L, 3L)), list(list(6L, 5L, 4L))))
+ result <- collect(select(df, array_contains(df[[1]], 1L)))[[1]]
+ expect_equal(result, c(TRUE, FALSE))
+
+ result <- collect(select(df, sort_array(df[[1]], FALSE)))[[1]]
+ expect_equal(result, list(list(3L, 2L, 1L), list(6L, 5L, 4L)))
+ result <- collect(select(df, sort_array(df[[1]])))[[1]]
+ expect_equal(result, list(list(1L, 2L, 3L), list(4L, 5L, 6L)))
})
#
test_that("column binary mathfunctions", {