aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst
diff options
context:
space:
mode:
authorfelixcheung <felixcheung_m@hotmail.com>2015-11-28 21:02:05 -0800
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-11-28 21:02:05 -0800
commit28e46ab46368ea3833c8e805163893bbb6f2a265 (patch)
tree40f106cde4a49f464281d33312d8abb6fa148e28 /R/pkg/inst
parent149cd692ee2e127d79386fd8e584f4f70a2906ba (diff)
downloadspark-28e46ab46368ea3833c8e805163893bbb6f2a265.tar.gz
spark-28e46ab46368ea3833c8e805163893bbb6f2a265.tar.bz2
spark-28e46ab46368ea3833c8e805163893bbb6f2a265.zip
[SPARK-12029][SPARKR] Improve column functions signature, param check, tests, fix doc and add examples
shivaram sun-rui Author: felixcheung <felixcheung_m@hotmail.com> Closes #10019 from felixcheung/rfunctionsdoc.
Diffstat (limited to 'R/pkg/inst')
-rw-r--r--R/pkg/inst/tests/test_sparkSQL.R9
1 files changed, 5 insertions, 4 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index 0fbe065826..899fc3b977 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -880,14 +880,15 @@ test_that("column functions", {
expect_equal(collect(df3)[[2, 1]], FALSE)
expect_equal(collect(df3)[[3, 1]], TRUE)
- expect_equal(collect(select(df, sum(df$age)))[1, 1], 49)
+ df4 <- select(df, countDistinct(df$age, df$name))
+ expect_equal(collect(df4)[[1, 1]], 2)
+ expect_equal(collect(select(df, sum(df$age)))[1, 1], 49)
expect_true(abs(collect(select(df, stddev(df$age)))[1, 1] - 7.778175) < 1e-6)
-
expect_equal(collect(select(df, var_pop(df$age)))[1, 1], 30.25)
- df4 <- createDataFrame(sqlContext, list(list(a = "010101")))
- expect_equal(collect(select(df4, conv(df4$a, 2, 16)))[1, 1], "15")
+ df5 <- createDataFrame(sqlContext, list(list(a = "010101")))
+ expect_equal(collect(select(df5, conv(df5$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))))