Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion r/R/dataset-format.R
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ csv_file_format_parse_opts <- function(...) {
# Catch cases when the user specifies a mix of Arrow C++ options and
# readr-style options
if (!all(is_readr_opt)) {
stop("Use either Arrow parse options or readr parse options, not both", call. = FALSE)
abort(c(
"CSV parse options must be either Arrow-style or readr-style, not both.",
i = sprintf("Arrow options used: %s.", oxford_paste(opt_names[is_arrow_opt])),
i = sprintf("readr options used: %s.", oxford_paste(opt_names[is_readr_opt]))
))
}
do.call(readr_to_csv_parse_options, opts) # all options have readr-style names
} else {
Expand Down
6 changes: 4 additions & 2 deletions r/tests/testthat/test-dataset-csv.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,18 @@ test_that("readr parse options", {
)

# With both Arrow and readr parse options (disallowed)
expect_error(
err <- expect_error(
open_dataset(
tsv_dir,
partitioning = "part",
format = "text",
quote = "\"",
quoting = TRUE
),
"either"
"Arrow-style or readr-style"
)
expect_match(conditionMessage(err), "Arrow options used:.*quoting")
expect_match(conditionMessage(err), "readr options used:.*quote")

# With ambiguous partial option names (disallowed)
expect_error(
Expand Down
Loading