Skip to content

Commit 10e70fe

Browse files
authored
Merge pull request #4 from HyukjinKwon/r-test-fix
Fix from_json test in R to check NA not the exception
2 parents adfde77 + 6326c9d commit 10e70fe

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

R/pkg/inst/tests/testthat/test_sparkSQL.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,9 +1354,8 @@ test_that("column functions", {
13541354
# passing option
13551355
df <- as.DataFrame(list(list("col" = "{\"date\":\"21/10/2014\"}")))
13561356
schema2 <- structType(structField("date", "date"))
1357-
expect_error(tryCatch(collect(select(df, from_json(df$col, schema2))),
1358-
error = function(e) { stop(e) }),
1359-
paste0(".*(java.lang.NumberFormatException: For input string:).*"))
1357+
s <- collect(select(df, from_json(df$col, schema2)))
1358+
expect_equal(s[[1]][[1]], NA)
13601359
s <- collect(select(df, from_json(df$col, schema2, dateFormat = "dd/MM/yyyy")))
13611360
expect_is(s[[1]][[1]]$date, "Date")
13621361
expect_equal(as.character(s[[1]][[1]]$date), "2014-10-21")

0 commit comments

Comments
 (0)