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/04/06 09:42:15 UTC

[GitHub] [arrow] assignUser commented on a diff in pull request #12799: ARROW-15827: [R] Improve UX of write_dataset(..., max_rows_per_group)

assignUser commented on code in PR #12799:
URL: https://github.com/apache/arrow/pull/12799#discussion_r843728947


##########
r/tests/testthat/test-dataset-write.R:
##########
@@ -506,6 +506,47 @@ test_that("Max partitions fails with non-integer values and less than required p
   )
 })
 
+test_that("max_rows_per_group is adjusted if at odds with max_rows_per_file", {
+  skip_if_not_available("parquet")
+  df <- tibble::tibble(
+    int = 1:10,
+    dbl = as.numeric(1:10),
+    lgl = rep(c(TRUE, FALSE, NA, TRUE, FALSE), 2),
+    chr = letters[1:10],
+  )
+  dst_dir <- make_temp_dir()
+
+  # max_rows_per_group unset => pass
+  expect_silent(
+    write_dataset(df, dst_dir, max_rows_per_file = 5)
+  )
+
+  expect_equal(
+    {
+      write_dataset(df, dst_dir, max_rows_per_file = 5)
+      list.files(dst_dir, "part-") %>%
+        length()
+    },
+    2
+  )

Review Comment:
   Agree, I was unsure writing it and you worded my doubts clearly, thanks!



-- 
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