ianmcook commented on a change in pull request #10032: URL: https://github.com/apache/arrow/pull/10032#discussion_r616057116
########## File path: r/tests/testthat/test-compute-aggregate.R ########## @@ -351,3 +351,71 @@ test_that("value_counts", { expect_identical(as.data.frame(value_counts(a)), result_df) expect_identical(as.vector(value_counts(a)$counts), result_df$counts) }) + +test_that("any.Array", { + + data <- c(1:10, NA, NA) + array_data <- Array$create(data) + + expect_equal(as.vector(any(array_data > 5)), any(data > 5)) + expect_equal(as.vector(any(array_data < 1)), any(data < 1)) + expect_equal(as.vector(any(array_data < 1, na.rm = TRUE)), any(data < 1, na.rm = TRUE)) Review comment: These tests could be simplified by using the helper function `expect_vector_equal()` (which is defined in `helper-expectation.R`). E.g.: ```suggestion expect_vector_equal(any(input > 5), data) expect_vector_equal(any(input < 1), data) expect_vector_equal(any(input < 1, na.rm = TRUE), data) ``` ########## File path: r/tests/testthat/test-compute-aggregate.R ########## @@ -351,3 +351,71 @@ test_that("value_counts", { expect_identical(as.data.frame(value_counts(a)), result_df) expect_identical(as.vector(value_counts(a)$counts), result_df$counts) }) + +test_that("any.Array", { + + data <- c(1:10, NA, NA) + array_data <- Array$create(data) + + expect_equal(as.vector(any(array_data > 5)), any(data > 5)) + expect_equal(as.vector(any(array_data < 1)), any(data < 1)) + expect_equal(as.vector(any(array_data < 1, na.rm = TRUE)), any(data < 1, na.rm = TRUE)) Review comment: Note that `expect_vector_equal()` tests both `Array` and `ChunkedArray` so you'll be able to reduce the number of tests used here -- 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