@@ -195,6 +195,27 @@ test_that("convert to vector works for nanoarrow_vctr()", {
195195 expect_identical(schema $ format , " +s" )
196196})
197197
198+ test_that(" batched convert to vector works for nanoarrow_vctr()" , {
199+ empty_stream <- basic_array_stream(list (), schema = na_string())
200+ empty_vctr <- convert_array_stream(empty_stream , nanoarrow_vctr())
201+ expect_length(empty_vctr , 0 )
202+ expect_identical(infer_nanoarrow_schema(empty_vctr )$ format , " u" )
203+
204+ stream1 <- basic_array_stream(list (c(" one" , " two" , " three" )))
205+ vctr1 <- convert_array_stream(stream1 , nanoarrow_vctr())
206+ expect_length(vctr1 , 3 )
207+
208+ stream2 <- basic_array_stream(
209+ list (c(" one" , " two" , " three" ), c(" four" , " five" , " six" , " seven" ))
210+ )
211+ vctr2 <- convert_array_stream(stream2 , nanoarrow_vctr())
212+ expect_length(vctr2 , 7 )
213+ expect_identical(
214+ convert_array_stream(as_nanoarrow_array_stream(vctr2 )),
215+ c(" one" , " two" , " three" , " four" , " five" , " six" , " seven" )
216+ )
217+ })
218+
198219test_that(" convert to vector works for struct-style vectors" , {
199220 array <- as_nanoarrow_array(as.POSIXlt(" 2021-01-01" , tz = " America/Halifax" ))
200221 expect_identical(
0 commit comments