You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/07/26 15:35:40 UTC

[GitHub] [arrow] nealrichardson commented on a diff in pull request #13690: ARROW-17088: [R] Use `.arrow` as extension of IPC files of datasets

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


##########
r/tests/testthat/test-dataset-write.R:
##########
@@ -139,6 +139,23 @@ test_that("Writing a dataset: Parquet->Parquet (default)", {
   )
 })
 
+test_that("Writing a dataset: `basename_template` default behavier", {

Review Comment:
   We should have a test of providing `basename_template`, looks like we don't have one. Would you be interested in adding one here?



##########
r/R/dataset-write.R:
##########
@@ -123,7 +124,7 @@ write_dataset <- function(dataset,
                           path,
                           format = c("parquet", "feather", "arrow", "ipc", "csv"),
                           partitioning = dplyr::group_vars(dataset),
-                          basename_template = paste0("part-{i}.", as.character(format)),
+                          basename_template = NULL,

Review Comment:
   I actually don't think you need this change due to the magic of lazy evaluation, you just need to add `format <- ifelse(as.character(format) %in% c("feather", "ipc"), "arrow", format)` after `format <- match.arg(format)`
   
   ```
   > f <- function(x = c("a", "b", "c"), basename_template = paste0("part-{i}.", x)) {
   +   x <- match.arg(x)
   +   x <- toupper(x)
   +   basename_template
   + }
   > f()
   [1] "part-{i}.A"
   ```
   
   The benefit of this is that you still get to see the default value for `basename_template` in the signature/docs.
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org