This is an automated email from the ASF dual-hosted git repository.

npr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 6c3f9f0  ARROW-11756: [R] passing a partition as a schema leads to 
segfaults
6c3f9f0 is described below

commit 6c3f9f04be7c255be4c773a26c9cf2c23063c90d
Author: Mauricio Vargas <[email protected]>
AuthorDate: Thu Feb 25 08:20:54 2021 -0800

    ARROW-11756: [R] passing a partition as a schema leads to segfaults
    
    Closes #9566 from pachamaltese/master
    
    Authored-by: Mauricio Vargas <[email protected]>
    Signed-off-by: Neal Richardson <[email protected]>
---
 r/R/dataset-factory.R           | 1 +
 r/R/dataset.R                   | 1 +
 r/tests/testthat/test-dataset.R | 6 ++++++
 3 files changed, 8 insertions(+)

diff --git a/r/R/dataset-factory.R b/r/R/dataset-factory.R
index 30622b8..a772be5 100644
--- a/r/R/dataset-factory.R
+++ b/r/R/dataset-factory.R
@@ -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)
       }
     },
diff --git a/r/R/dataset.R b/r/R/dataset.R
index e990ff3..3f7d117 100644
--- a/r/R/dataset.R
+++ b/r/R/dataset.R
@@ -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
diff --git a/r/tests/testthat/test-dataset.R b/r/tests/testthat/test-dataset.R
index e84eb12..2dbf9c5 100644
--- a/r/tests/testthat/test-dataset.R
+++ b/r/tests/testthat/test-dataset.R
@@ -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")

Reply via email to