ianmcook commented on a change in pull request #10476:
URL: https://github.com/apache/arrow/pull/10476#discussion_r647632845



##########
File path: r/tests/testthat/test-compute-aggregate.R
##########
@@ -383,33 +383,30 @@ test_that("value_counts", {
 })
 
 test_that("any.Array and any.ChunkedArray", {
-  
   data <- c(1:10, NA, NA)
 
-  expect_vector_equal(any(input > 5), data)
+  expect_vector_equal(any(input > 5, na.rm = TRUE), data)
   expect_vector_equal(any(input < 1), data)
   expect_vector_equal(any(input < 1, na.rm = TRUE), data)
   
   data_logical <- c(TRUE, FALSE, TRUE, NA, FALSE)

Review comment:
       To properly test that `any()` is handling `na.rm` consistent with the 
way base R does, we should test with a vector that does not have any `TRUE` in 
it. Maybe let's add another few lines of test code here to verify that, and 
perserve the existing tests too:
   ```suggestion
     data_logical <- c(NA, FALSE, FALSE, NA, FALSE)
     expect_vector_equal(any(input), data_logical)
     expect_vector_equal(any(input, na.rm = FALSE), data_logical)
     expect_vector_equal(any(input, na.rm = TRUE), data_logical)
     
     data_logical <- c(TRUE, FALSE, TRUE, NA, FALSE)
   ```




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