Skip to content
1 change: 1 addition & 0 deletions r/R/dataset-factory.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ DatasetFactory <- R6Class("DatasetFactory", inherit = ArrowObject,
if (is.null(schema)) {
dataset___DatasetFactory__Finish1(self, unify_schemas)
} else {
assert_is(schema, "Schema")
dataset___DatasetFactory__Finish2(self, schema)
}
},
Expand Down
1 change: 1 addition & 0 deletions r/R/dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ open_dataset <- function(sources,
}
}
# Enforce that all datasets have the same schema
assert_is(schema, "Schema")
sources <- lapply(sources, function(x) {
x$schema <- schema
x
Expand Down
6 changes: 6 additions & 0 deletions r/tests/testthat/test-dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ test_that("Hive partitioning", {
)
})

test_that("input validation", {
expect_error(
open_dataset(hive_dir, hive_partition(other = utf8(), group = uint8()))
)
})

test_that("Partitioning inference", {
# These are the same tests as above, just using the *PartitioningFactory
ds1 <- open_dataset(dataset_dir, partitioning = "part")
Expand Down