Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add csv reading test for duckdb_read_csv(na.strings = ) #10

Merged
merged 4 commits into from
Feb 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/testthat/test_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,21 @@ 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()
csv <- c(
'"num","char","logi","lisst.1","lisst.2","lisst.3","lisst.NA"',
'0.5,"yes",TRUE,1,2,3,NA',
'2,"no",FALSE,1,2,3,NA',
'NA,NA,NA,1,2,3,NA'
)
writeLines(csv, tf3)
duckdb_read_csv(con, "na_table", tf3, na.strings = "-")
expect_identical(
dbReadTable(con, "na_table"),
read.csv(tf3, na.strings = "-")
)

dbDisconnect(con, shutdown = TRUE)
})
})
Loading