You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sh...@apache.org on 2015/06/26 19:07:39 UTC
spark git commit: [SPARK-8662] SparkR Update SparkSQL Test
Repository: spark
Updated Branches:
refs/heads/branch-1.4 6abb4fc8a -> 78b31a2a6
[SPARK-8662] SparkR Update SparkSQL Test
Test `infer_type` using a more fine-grained approach rather than comparing environments. Since `all.equal`'s behavior has changed in R 3.2, the test became unpassable.
JIRA here:
https://issues.apache.org/jira/browse/SPARK-8662
Author: cafreeman <cf...@alteryx.com>
Closes #7045 from cafreeman/R32_Test and squashes the following commits:
b97cc52 [cafreeman] Add `checkStructField` utility
3381e5c [cafreeman] Update SparkSQL Test
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/78b31a2a
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/78b31a2a
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/78b31a2a
Branch: refs/heads/branch-1.4
Commit: 78b31a2a630c2178987322d0221aeea183ec565f
Parents: 6abb4fc
Author: cafreeman <cf...@alteryx.com>
Authored: Fri Jun 26 10:07:35 2015 -0700
Committer: Shivaram Venkataraman <sh...@cs.berkeley.edu>
Committed: Fri Jun 26 10:07:35 2015 -0700
----------------------------------------------------------------------
R/pkg/inst/tests/test_sparkSQL.R | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/78b31a2a/R/pkg/inst/tests/test_sparkSQL.R
----------------------------------------------------------------------
diff --git a/R/pkg/inst/tests/test_sparkSQL.R b/R/pkg/inst/tests/test_sparkSQL.R
index fc7f3f0..52fb7f8 100644
--- a/R/pkg/inst/tests/test_sparkSQL.R
+++ b/R/pkg/inst/tests/test_sparkSQL.R
@@ -19,6 +19,14 @@ library(testthat)
context("SparkSQL functions")
+# Utility function for easily checking the values of a StructField
+checkStructField <- function(actual, expectedName, expectedType, expectedNullable) {
+ expect_equal(class(actual), "structField")
+ expect_equal(actual$name(), expectedName)
+ expect_equal(actual$dataType.toString(), expectedType)
+ expect_equal(actual$nullable(), expectedNullable)
+}
+
# Tests for SparkSQL functions in SparkR
sc <- sparkR.init()
@@ -52,9 +60,10 @@ test_that("infer types", {
list(type = 'array', elementType = "integer", containsNull = TRUE))
expect_equal(infer_type(list(1L, 2L)),
list(type = 'array', elementType = "integer", containsNull = TRUE))
- expect_equal(infer_type(list(a = 1L, b = "2")),
- structType(structField(x = "a", type = "integer", nullable = TRUE),
- structField(x = "b", type = "string", nullable = TRUE)))
+ testStruct <- infer_type(list(a = 1L, b = "2"))
+ expect_true(class(testStruct) == "structType")
+ checkStructField(testStruct$fields()[[1]], "a", "IntegerType", TRUE)
+ checkStructField(testStruct$fields()[[2]], "b", "StringType", TRUE)
e <- new.env()
assign("a", 1L, envir = e)
expect_equal(infer_type(e),
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org