aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/inst/tests/testthat/test_sparkSQL.R
diff options
context:
space:
mode:
authorSun Rui <sunrui2016@gmail.com>2016-05-03 09:29:49 -0700
committerShivaram Venkataraman <shivaram@cs.berkeley.edu>2016-05-03 09:29:49 -0700
commit8b6491fc0b49b4e363887ae4b452ba69fe0290d5 (patch)
treeeca87e0d6c0489ec0b4cb1a1978bb4739cf28bb3 /R/pkg/inst/tests/testthat/test_sparkSQL.R
parentd26f7cb0121767da678bbbbf3a0e31c63d5e3159 (diff)
downloadspark-8b6491fc0b49b4e363887ae4b452ba69fe0290d5.tar.gz
spark-8b6491fc0b49b4e363887ae4b452ba69fe0290d5.tar.bz2
spark-8b6491fc0b49b4e363887ae4b452ba69fe0290d5.zip
[SPARK-15091][SPARKR] Fix warnings and a failure in SparkR test cases with testthat version 1.0.1
## What changes were proposed in this pull request? Fix warnings and a failure in SparkR test cases with testthat version 1.0.1 ## How was this patch tested? SparkR unit test cases. Author: Sun Rui <sunrui2016@gmail.com> Closes #12867 from sun-rui/SPARK-15091.
Diffstat (limited to 'R/pkg/inst/tests/testthat/test_sparkSQL.R')
-rw-r--r--R/pkg/inst/tests/testthat/test_sparkSQL.R11
1 files changed, 5 insertions, 6 deletions
diff --git a/R/pkg/inst/tests/testthat/test_sparkSQL.R b/R/pkg/inst/tests/testthat/test_sparkSQL.R
index 5cf9dc405b..081f7b1663 100644
--- a/R/pkg/inst/tests/testthat/test_sparkSQL.R
+++ b/R/pkg/inst/tests/testthat/test_sparkSQL.R
@@ -1196,9 +1196,9 @@ test_that("date functions on a DataFrame", {
c(as.POSIXlt("2012-12-13 21:34:00 UTC"), as.POSIXlt("2014-12-15 10:24:34 UTC")))
expect_equal(collect(select(df2, to_utc_timestamp(df2$b, "JST")))[, 1],
c(as.POSIXlt("2012-12-13 03:34:00 UTC"), as.POSIXlt("2014-12-14 16:24:34 UTC")))
- expect_more_than(collect(select(df2, unix_timestamp()))[1, 1], 0)
- expect_more_than(collect(select(df2, unix_timestamp(df2$b)))[1, 1], 0)
- expect_more_than(collect(select(df2, unix_timestamp(lit("2015-01-01"), "yyyy-MM-dd")))[1, 1], 0)
+ expect_gt(collect(select(df2, unix_timestamp()))[1, 1], 0)
+ expect_gt(collect(select(df2, unix_timestamp(df2$b)))[1, 1], 0)
+ expect_gt(collect(select(df2, unix_timestamp(lit("2015-01-01"), "yyyy-MM-dd")))[1, 1], 0)
l3 <- list(list(a = 1000), list(a = -1000))
df3 <- createDataFrame(sqlContext, l3)
@@ -1502,7 +1502,6 @@ test_that("toJSON() returns an RDD of the correct values", {
test_that("showDF()", {
df <- read.json(sqlContext, jsonPath)
- s <- capture.output(showDF(df))
expected <- paste("+----+-------+\n",
"| age| name|\n",
"+----+-------+\n",
@@ -1510,7 +1509,7 @@ test_that("showDF()", {
"| 30| Andy|\n",
"| 19| Justin|\n",
"+----+-------+\n", sep = "")
- expect_output(s, expected)
+ expect_output(showDF(df), expected)
})
test_that("isLocal()", {
@@ -1896,7 +1895,7 @@ test_that("Method as.data.frame as a synonym for collect()", {
expect_equal(as.data.frame(irisDF2), collect(irisDF2))
# Make sure as.data.frame in the R base package is not covered
- expect_that(as.data.frame(c(1, 2)), not(throws_error()))
+ expect_error(as.data.frame(c(1, 2)), NA)
})
test_that("attach() on a DataFrame", {