paleolimbot edited a comment on pull request #11783:
URL: https://github.com/apache/arrow/pull/11783#issuecomment-982028406
(edited from the earlier reprex, which wasn't very clear!)
I was just wondering if it's worth adding a test for this to verify that the
problem is fixed! It looks like this PR did the trick:
``` r
# remotes::install_github("apache/arrow/r#11783")
library(arrow, warn.conflicts = FALSE)
pretty_big_array <- Array$create(raw(2^30))
cols <- rep(list(pretty_big_array), 10)
names(cols) <- paste0("col", seq_along(cols))
big_table <- Table$create(!!! cols)
# make sure the table is big enough
big_table$num_columns * big_table$num_rows
#> Warning in big_table$num_columns * big_table$num_rows: NAs produced by
integer
#> overflow
#> [1] NA
temp <- tempfile()
write_parquet(big_table, temp)
unlink(temp)
```
My initial try just used a vector that was longer than the integer range
(chunked array, since it seems like long Arrays aren't supported). This fails
for a different reason with the same error (but totally a different issue!)
``` r
# remotes::install_github("apache/arrow/r#11783")
library(arrow, warn.conflicts = FALSE)
# test that read_parquet() works with a regular table (num_rows is integer)
test_array1 <- Array$create(raw(2^31 - 2))
test_array2 <- Array$create(raw(1))
big_chunked <- chunked_array(test_array1, test_array2)
big_table <- Table$create(col = big_chunked)
typeof(big_table$num_rows)
#> [1] "integer"
temp <- tempfile()
write_parquet(big_table, temp)
unlink(temp)
# test that read_parquet() works with a long table (num_rows is out of
integer range)
# (using ChunkedArray because long Array is not supported and using raw()
# because it uses the least memory)
test_array1 <- Array$create(raw(2^31 - 1))
test_array2 <- Array$create(raw(1))
big_chunked <- chunked_array(test_array1, test_array2)
big_table <- Table$create(col = big_chunked)
# I think this is the problem!
big_table$num_rows
#> [1] NA
typeof(big_table$num_rows)
#> [1] "integer"
temp <- tempfile()
write_parquet(big_table, temp)
#> Error in if (num_cells < target_cells_per_group) {: missing value where
TRUE/FALSE needed
unlink(temp)
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]