Skip to content

Commit

Permalink
add csv reading test for na.strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Tmonster authored and krlmlr committed Nov 8, 2023
1 parent 933b747 commit bf309a8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/testthat/test_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,16 @@ test_that("duckdb_read_csv() works as expected", {
res$Species <- as.factor(res$Species)
expect_true(identical(res, iris))

# test better na.strings handling
# see https://github.com/duckdb/duckdb/issues/8590
tf3 <- tempfile()
na_strings <- data.frame(num=c(1, 2, NA), char=c('yes', 'no', NA), logi=c(TRUE, FALSE, NA))
write.csv(na_strings, tf3, row.names = FALSE)
duckdb_read_csv(con, "na_table", tf3, na.strings = "-")
identical(
dbReadTable(con, "na_table"),
read.csv(tf3, na.strings = "-")
)

dbDisconnect(con, shutdown = TRUE)
})

0 comments on commit bf309a8

Please sign in to comment.