nealrichardson commented on code in PR #14679:
URL: https://github.com/apache/arrow/pull/14679#discussion_r1046036035


##########
r/R/csv.R:
##########
@@ -455,25 +457,32 @@ CsvReadOptions$create <- function(use_threads = 
option_use_threads(),
   options
 }
 
-readr_to_csv_write_options <- function(include_header,
-                                       batch_size = 1024L) {
+readr_to_csv_write_options <- function(include_header = TRUE,
+                                       batch_size = 1024L,
+                                       na = "") {
   assert_that(is_integerish(batch_size, n = 1, finite = TRUE), batch_size > 0)
   assert_that(is.logical(include_header))
+  assert_that(is.character(na))
+  assert_that(length(na) == 1)
+  assert_that(!grepl('"', na), msg = "na argument must not contain quote 
characters.")

Review Comment:
   Should this assertion move down into `CsvWriteOptions$create`?



##########
r/R/csv.R:
##########
@@ -455,25 +457,32 @@ CsvReadOptions$create <- function(use_threads = 
option_use_threads(),
   options
 }
 
-readr_to_csv_write_options <- function(include_header,
-                                       batch_size = 1024L) {
+readr_to_csv_write_options <- function(include_header = TRUE,
+                                       batch_size = 1024L,
+                                       na = "") {
   assert_that(is_integerish(batch_size, n = 1, finite = TRUE), batch_size > 0)
   assert_that(is.logical(include_header))
+  assert_that(is.character(na))
+  assert_that(length(na) == 1)
+  assert_that(!grepl('"', na), msg = "na argument must not contain quote 
characters.")
+
   CsvWriteOptions$create(
     include_header = include_header,
-    batch_size = as.integer(batch_size)
+    batch_size = as.integer(batch_size),
+    null_string = na
   )
 }
 
 #' @rdname CsvReadOptions
 #' @export
 CsvWriteOptions <- R6Class("CsvWriteOptions", inherit = ArrowObject)
-CsvWriteOptions$create <- function(include_header = TRUE, batch_size = 1024L) {
+CsvWriteOptions$create <- function(include_header = TRUE, batch_size = 1024L, 
null_string = "") {

Review Comment:
   What happens if `null_string = NA`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to