nealrichardson commented on code in PR #13690:
URL: https://github.com/apache/arrow/pull/13690#discussion_r934671899
##########
r/tests/testthat/test-dataset-write.R:
##########
@@ -470,7 +502,7 @@ test_that("Dataset writing: unsupported features/input
validation", {
write_dataset(ds, tempfile(), basename_template = "something_without_i")
)
expect_error(
- write_dataset(ds, tempfile(), basename_template = NULL)
+ write_dataset(ds, tempfile(), basename_template = "NULL")
Review Comment:
Is this change necessary?
##########
r/R/dataset-write.R:
##########
@@ -133,6 +134,7 @@ write_dataset <- function(dataset,
max_rows_per_group = bitwShiftL(1, 20),
...) {
format <- match.arg(format)
+ format <- ifelse(as.character(format) %in% c("feather", "ipc"), "arrow",
as.character(format))
Review Comment:
Just a stylistic thing, IMO this is more readable
```suggestion
if (format %in% c("feather", "ipc")) {
format <- "arrow"
}
```
##########
r/tests/testthat/test-dataset-write.R:
##########
@@ -139,6 +139,36 @@ test_that("Writing a dataset: Parquet->Parquet (default)",
{
)
})
+test_that("Writing a dataset: `basename_template` default behavier", {
+ ds <- open_dataset(csv_dir, partitioning = "part", format = "csv")
+
+ dst_dir <- make_temp_dir()
+ write_dataset(ds, dst_dir, format = "parquet", max_rows_per_file = 5L)
+ expect_identical(
+ dir(dst_dir, full.names = FALSE, recursive = TRUE),
+ paste0("part-", 0:3, ".parquet")
+ )
+
+ dst_dir <- make_temp_dir()
+ expect_error(
+ write_dataset(ds, dst_dir, format = "parquet", basename_template =
"part-i.parquet"),
Review Comment:
We test the error mode below. How about something with a different
basename_template that is valid, like "{i}.data" or something?
--
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]