Skip to content

Commit 3381e5c

Browse files
author
cafreeman
committed
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
1 parent 6abb4fc commit 3381e5c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

R/pkg/inst/tests/test_sparkSQL.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ test_that("infer types", {
5252
list(type = 'array', elementType = "integer", containsNull = TRUE))
5353
expect_equal(infer_type(list(1L, 2L)),
5454
list(type = 'array', elementType = "integer", containsNull = TRUE))
55-
expect_equal(infer_type(list(a = 1L, b = "2")),
56-
structType(structField(x = "a", type = "integer", nullable = TRUE),
57-
structField(x = "b", type = "string", nullable = TRUE)))
55+
testStruct <- infer_type(list(a = 1L, b = "2"))
56+
expect_true(class(testStruct) == "structType")
57+
expect_true(length(testStruct$fields()) == 2)
58+
testSF <- testStruct$fields()[[1]]
59+
expect_true(class(testSF) == "structField")
60+
expect_true(testSF$name() == "a")
61+
expect_true(testSF$dataType.toString() == "IntegerType")
5862
e <- new.env()
5963
assign("a", 1L, envir = e)
6064
expect_equal(infer_type(e),

0 commit comments

Comments
 (0)