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



##########
File path: r/tests/testthat/test-Array.R
##########
@@ -131,14 +131,14 @@ test_that("Slice() and RangeEquals()", {
   expect_true(x$RangeEquals(z, 10, 15, 0))
 
   # Input validation
-  expect_error(x$Slice("ten"), class = "Rcpp::not_compatible")
+  expect_error(x$Slice("ten"))

Review comment:
       Is there an equivalent class to the exception that cpp11 raises? Should 
there be?

##########
File path: r/R/array.R
##########
@@ -119,9 +119,9 @@ Array <- R6Class("Array",
     },
     Slice = function(offset, length = NULL) {
       if (is.null(length)) {
-        Array$create(Array__Slice1(self, offset))
+        Array$create(Array__Slice1(self, as_index(offset)))
       } else {
-        Array$create(Array__Slice2(self, offset, length))
+        Array$create(Array__Slice2(self, as_index(offset), length))

Review comment:
       If `offset` needs this then so should `length`. Also I expect that 
you'll want/have to use this in lots of other places.
   
   ```suggestion
           Array$create(Array__Slice2(self, as_index(offset), as_index(length)))
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to