aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests
diff options
context:
space:
mode:
authorLiang-Chi Hsieh <viirya@appier.com>2015-07-15 23:36:57 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2015-07-15 23:36:57 -0700
commit0a795336df20c7ec969366e613286f0c060a4eeb (patch)
treeeda1c329388eaa8736debc469363ec5b9d2b1dc2 /R/pkg/inst/tests
parente27212317c7341852c52d9a85137b8f94cb0d935 (diff)
downloadspark-0a795336df20c7ec969366e613286f0c060a4eeb.tar.gz
spark-0a795336df20c7ec969366e613286f0c060a4eeb.tar.bz2
spark-0a795336df20c7ec969366e613286f0c060a4eeb.zip
[SPARK-8807] [SPARKR] Add between operator in SparkR
JIRA: https://issues.apache.org/jira/browse/SPARK-8807 Add between operator in SparkR. Author: Liang-Chi Hsieh <viirya@appier.com> Closes #7356 from viirya/add_r_between and squashes the following commits: 7f51b44 [Liang-Chi Hsieh] Add test for non-numeric column. c6a25c5 [Liang-Chi Hsieh] Add between function.
Diffstat (limited to 'R/pkg/inst/tests')
-rw-r--r--R/pkg/inst/tests/test_sparkSQL.R12
1 files changed, 12 insertions, 0 deletions
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index 76f74f8083..cdfe6481f6 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -638,6 +638,18 @@ test_that("column functions", {
c7 <- floor(c) + log(c) + log10(c) + log1p(c) + rint(c)
c8 <- sign(c) + sin(c) + sinh(c) + tan(c) + tanh(c)
c9 <- toDegrees(c) + toRadians(c)
+
+ df <- jsonFile(sqlContext, jsonPath)
+ df2 <- select(df, between(df$age, c(20, 30)), between(df$age, c(10, 20)))
+ expect_equal(collect(df2)[[2, 1]], TRUE)
+ expect_equal(collect(df2)[[2, 2]], FALSE)
+ expect_equal(collect(df2)[[3, 1]], FALSE)
+ expect_equal(collect(df2)[[3, 2]], TRUE)
+
+ df3 <- select(df, between(df$name, c("Apache", "Spark")))
+ expect_equal(collect(df3)[[1, 1]], TRUE)
+ expect_equal(collect(df3)[[2, 1]], FALSE)
+ expect_equal(collect(df3)[[3, 1]], TRUE)
})
test_that("column binary mathfunctions", {