jonkeane commented on a change in pull request #9972:
URL: https://github.com/apache/arrow/pull/9972#discussion_r612729383
##########
File path: r/tests/testthat/test-dataset.R
##########
@@ -1778,3 +1778,60 @@ test_that("Collecting zero columns from a dataset
doesn't return entire dataset"
c(32, 0)
)
})
+
+# see https://issues.apache.org/jira/browse/ARROW-12315
+test_that("Max partitions fails with non-integer values and less than required
partitions values", {
+ skip_if_not_available("parquet")
+ tmp <- tempfile()
+
+ # this example needs 3 partitions
+
+ # max_partitions = chr => error
+ expect_error(
+ mtcars %>%
+ group_by(cyl) %>%
+ write_dataset(tmp, format = "parquet", max_partitions = "foobar")
+ )
+
+ # max_partitions < 3 => error
+ expect_error(
+ mtcars %>%
+ group_by(cyl) %>%
+ write_dataset(tmp, format = "parquet", max_partitions = -3)
+ )
+
+ # max_partitions < 3 => error
+ expect_error(
+ mtcars %>%
+ group_by(cyl) %>%
+ write_dataset(tmp, format = "parquet", max_partitions = 1)
+ )
Review comment:
Yeah, this looks fine too me, let's use the c++ error. If the error is
coming directly from c++ (and it's tested there), we don't actually need to
test it here as well.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]