diff options
author | Yu ISHIKAWA <yuu.ishikawa@gmail.com> | 2015-08-19 12:39:37 -0700 |
---|---|---|
committer | Shivaram Venkataraman <shivaram@cs.berkeley.edu> | 2015-08-19 12:39:37 -0700 |
commit | d898c33f774b9a3db2fb6aa8f0cb2c2ac6004b58 (patch) | |
tree | c97c1209ff5b424af6795584c28f2b1ce058904e /R/pkg/inst/tests/test_sparkSQL.R | |
parent | 28a98464ea65aa7b35e24fca5ddaa60c2e5d53ee (diff) | |
download | spark-d898c33f774b9a3db2fb6aa8f0cb2c2ac6004b58.tar.gz spark-d898c33f774b9a3db2fb6aa8f0cb2c2ac6004b58.tar.bz2 spark-d898c33f774b9a3db2fb6aa8f0cb2c2ac6004b58.zip |
[SPARK-10106] [SPARKR] Add `ifelse` Column function to SparkR
### JIRA
[[SPARK-10106] Add `ifelse` Column function to SparkR - ASF JIRA](https://issues.apache.org/jira/browse/SPARK-10106)
Author: Yu ISHIKAWA <yuu.ishikawa@gmail.com>
Closes #8303 from yu-iskw/SPARK-10106.
Diffstat (limited to 'R/pkg/inst/tests/test_sparkSQL.R')
-rw-r--r-- | R/pkg/inst/tests/test_sparkSQL.R | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R index 670017ed34..556b8c5447 100644 --- a/R/pkg/inst/tests/test_sparkSQL.R +++ b/R/pkg/inst/tests/test_sparkSQL.R @@ -813,11 +813,12 @@ test_that("greatest() and least() on a DataFrame", { expect_equal(collect(select(df, least(df$a, df$b)))[, 1], c(1, 3)) }) -test_that("when() and otherwise() on a DataFrame", { +test_that("when(), otherwise() and ifelse() on a DataFrame", { l <- list(list(a = 1, b = 2), list(a = 3, b = 4)) df <- createDataFrame(sqlContext, l) expect_equal(collect(select(df, when(df$a > 1 & df$b > 2, 1)))[, 1], c(NA, 1)) expect_equal(collect(select(df, otherwise(when(df$a > 1, 1), 0)))[, 1], c(0, 1)) + expect_equal(collect(select(df, ifelse(df$a > 1 & df$b > 2, 0, 1)))[, 1], c(1, 0)) }) test_that("group by", { |