You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/31 13:19:08 UTC
[GitHub] [arrow] nealrichardson commented on a change in pull request #11033: ARROW-13761: [R] arrow::filter() crashes (aborts R session)
nealrichardson commented on a change in pull request #11033:
URL: https://github.com/apache/arrow/pull/11033#discussion_r699314390
##########
File path: r/tests/testthat/test-chunked-array.R
##########
@@ -202,6 +202,22 @@ test_that("ChunkedArray supports difftime", {
expect_chunked_roundtrip(list(time, time), time32("s"))
})
+test_that("ChunkedArray supports empty arrays (ARROW-13761)", {
+ types <- c(int8(), int16(), int32(), int64(), uint8(), uint16(), uint32(),
+ uint64(), float32(), float64(), timestamp('ns'), binary(),
+ large_binary(), fixed_size_binary(32), date32(), date64(),
+ decimal(4, 2))
+
+ for (type in c(types)) {
+ one_empty_chunk <- ChunkedArray$create(type=type)
+ expect_type_equal(one_empty_chunk$type, type)
+ expect_identical(length(one_empty_chunk), length(as.vector(one_empty_chunk)))
+ zero_empty_chunks <- one_empty_chunk$Filter(ChunkedArray$create(type = bool()))
+ expect_type_equal(zero_empty_chunks$type, type)
Review comment:
```suggestion
uint64(), float32(), float64(), timestamp("ns"), binary(),
large_binary(), fixed_size_binary(32), date32(), date64(),
decimal(4, 2))
empty_filter <- ChunkedArray$create(type = bool())
for (type in types) {
one_empty_chunk <- ChunkedArray$create(type = type)
expect_type_equal(one_empty_chunk$type, type)
expect_identical(length(one_empty_chunk), length(as.vector(one_empty_chunk)))
zero_empty_chunks <- one_empty_chunk$Filter(empty_filter)
expect_equal(zero_empty_chunks$num_chunks, 0)
expect_type_equal(zero_empty_chunks$type, type)
```
--
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.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org