nealrichardson commented on a change in pull request #9743:
URL: https://github.com/apache/arrow/pull/9743#discussion_r597270252



##########
File path: r/tests/testthat/test-parquet.R
##########
@@ -234,3 +234,17 @@ test_that("ParquetFileReader $ReadRowGroup(s) methods", {
   expect_true(reader$ReadRowGroups(c(0, 1), 0) == Table$create(x = 1:20))
   expect_error(reader$ReadRowGroups(c(0, 1), 1))
 })
+
+test_that("Error messages are shown when the compression algorithm lz4/snappy
+          is not found", {
+  skip_on_cran()
+  if (codec_is_available("snappy")) {
+    d <- read_parquet(system.file("extdata", "pets.parquet", package = 
"arrow"))

Review comment:
       This file isn't necessary because the example parquet file in `inst/` is 
snappy compressed, so you can use that. (Look for 
`skip_if_not_available("snappy")` throughout this file.)

##########
File path: r/R/feather.R
##########
@@ -154,7 +154,15 @@ read_feather <- function(file, col_select = NULL, 
as_data_frame = TRUE, ...) {
     vars_select(names(reader), !!col_select)
   }
 
-  out <- reader$Read(columns)
+  out <- tryCatch(
+    reader$Read(columns),
+    error = function (e) {
+      if (grepl("Support for codec", conditionMessage(e))) {
+        msg <- "Unsupported compressed format: We suggest either setting the 
right environment variable to install binaries or setting 
LIBARROW_MINIMAL=false and then reinstall the package."

Review comment:
       1. Name the compression format
   2. "setting the right environment variable" isn't helpful--which is the 
right one? (Hint: you know the codec from the error message)

##########
File path: r/R/feather.R
##########
@@ -154,7 +154,15 @@ read_feather <- function(file, col_select = NULL, 
as_data_frame = TRUE, ...) {
     vars_select(names(reader), !!col_select)
   }
 
-  out <- reader$Read(columns)
+  out <- tryCatch(

Review comment:
       I see this same code repeated in 3 places. How about factoring out to a 
function?




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


Reply via email to