This is an automated email from the ASF dual-hosted git repository.

jonkeane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 7389a270c2 GH-33420: [R] Improve error message when providing a mix of 
readr and Arrow options (#50048)
7389a270c2 is described below

commit 7389a270c204292e27a67dcb55bc734e323811f8
Author: RIchard Baah <[email protected]>
AuthorDate: Mon Jun 8 09:11:25 2026 -0400

    GH-33420: [R] Improve error message when providing a mix of readr and Arrow 
options (#50048)
    
    
    ### Rationale for this change
    closes #33420
    
    ### What changes are included in this PR?
    updates the error message returned
    ### Are these changes tested?
    No, minimal change so I don't think its needed
    ### Are there any user-facing changes?
    better error responses for users.
    
    * GitHub Issue: #33420
    
    Authored-by: Richard <[email protected]>
    Signed-off-by: Jonathan Keane <[email protected]>
---
 r/R/dataset-format.R                | 6 +++++-
 r/tests/testthat/test-dataset-csv.R | 6 ++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/r/R/dataset-format.R b/r/R/dataset-format.R
index fcdcffedf1..60ede3553a 100644
--- a/r/R/dataset-format.R
+++ b/r/R/dataset-format.R
@@ -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 {
diff --git a/r/tests/testthat/test-dataset-csv.R 
b/r/tests/testthat/test-dataset-csv.R
index ce3f94e7f5..8e6f5aa6f3 100644
--- a/r/tests/testthat/test-dataset-csv.R
+++ b/r/tests/testthat/test-dataset-csv.R
@@ -231,7 +231,7 @@ test_that("readr parse options", {
   )
 
   # With both Arrow and readr parse options (disallowed)
-  expect_error(
+  err <- expect_error(
     open_dataset(
       tsv_dir,
       partitioning = "part",
@@ -239,8 +239,10 @@ test_that("readr parse options", {
       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(

Reply via email to