Repository: spark Updated Branches: refs/heads/master 64bbd134e -> 39d3d6cc9
[SPARK-25167][SPARKR][TEST][MINOR] Minor fixes for R sql tests (timestamp comparison) ## What changes were proposed in this pull request? The "date function on DataFrame" test fails consistently on my laptop. In this PR i am fixing it by changing the way we compare the two timestamp values. With this change i am able to run the tests clean. ## How was this patch tested? Fixed the failing test. Author: Dilip Biswal <dbis...@us.ibm.com> Closes #22274 from dilipbiswal/r-sql-test-fix2. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/39d3d6cc Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/39d3d6cc Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/39d3d6cc Branch: refs/heads/master Commit: 39d3d6cc965bd09b1719d245e672b013b8cee6f7 Parents: 64bbd13 Author: Dilip Biswal <dbis...@us.ibm.com> Authored: Mon Sep 3 00:38:08 2018 -0700 Committer: Felix Cheung <felixche...@apache.org> Committed: Mon Sep 3 00:38:08 2018 -0700 ---------------------------------------------------------------------- R/pkg/tests/fulltests/test_sparkSQL.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/39d3d6cc/R/pkg/tests/fulltests/test_sparkSQL.R ---------------------------------------------------------------------- diff --git a/R/pkg/tests/fulltests/test_sparkSQL.R b/R/pkg/tests/fulltests/test_sparkSQL.R index 17e4a97..5c07a02 100644 --- a/R/pkg/tests/fulltests/test_sparkSQL.R +++ b/R/pkg/tests/fulltests/test_sparkSQL.R @@ -1870,9 +1870,9 @@ test_that("date functions on a DataFrame", { expect_equal(collect(select(df2, minute(df2$b)))[, 1], c(34, 24)) expect_equal(collect(select(df2, second(df2$b)))[, 1], c(0, 34)) expect_equal(collect(select(df2, from_utc_timestamp(df2$b, "JST")))[, 1], - c(as.POSIXlt("2012-12-13 21:34:00 UTC"), as.POSIXlt("2014-12-15 10:24:34 UTC"))) + c(as.POSIXct("2012-12-13 21:34:00 UTC"), as.POSIXct("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"))) + c(as.POSIXct("2012-12-13 03:34:00 UTC"), as.POSIXct("2014-12-14 16:24:34 UTC"))) 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) @@ -3652,7 +3652,8 @@ test_that("catalog APIs, currentDatabase, setCurrentDatabase, listDatabases", { expect_equal(currentDatabase(), "default") expect_error(setCurrentDatabase("default"), NA) expect_error(setCurrentDatabase("zxwtyswklpf"), - "Error in setCurrentDatabase : analysis error - Database 'zxwtyswklpf' does not exist") + paste0("Error in setCurrentDatabase : analysis error - Database ", + "'zxwtyswklpf' does not exist")) dbs <- collect(listDatabases()) expect_equal(names(dbs), c("name", "description", "locationUri")) expect_equal(which(dbs[, 1] == "default"), 1) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org