Skip to content

Commit

Permalink
test: ensure auto rechunk
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi committed May 6, 2024
1 parent f7d917a commit a70fbf6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/testthat/test-as_polars.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,27 @@ test_that("as_polars_df and pl$DataFrame for data.frame has list column", {
as_polars_df(data)$dtypes[[1]] == pl$List(pl$Struct(b = pl$Int32))
)
})


test_that("automatically rechunked for struct array stream", {
skip_if_not_installed("nanoarrow")

s_int = nanoarrow::basic_array_stream(
list(
nanoarrow::as_nanoarrow_array(1:5),
nanoarrow::as_nanoarrow_array(6:10)
)
) |>
as_polars_series()

s_struct = nanoarrow::basic_array_stream(
list(
nanoarrow::as_nanoarrow_array(mtcars[1:5, ]),
nanoarrow::as_nanoarrow_array(mtcars[6:10, ])
)
) |>
as_polars_series()

expect_identical(s_int$n_chunks(), 2)
expect_identical(s_struct$n_chunks(), 1)
})

0 comments on commit a70fbf6

Please sign in to comment.