to_arrow function

Create an Arrow object from a DuckDB connection

Create an Arrow object from a DuckDB connection

This can be used in pipelines that pass data back and forth between Arrow and DuckDB.

to_arrow(.data)

Arguments

  • .data: the object to be converted

Returns

A RecordBatchReader.

Details

Note that you can only call collect() or compute() on the result of this function once. To work around this limitation, you should either only call collect() as the final step in a pipeline or call as_arrow_table() on the result to materialize the entire Table in-memory.

Examples

library(dplyr) ds <- InMemoryDataset$create(mtcars) ds %>% filter(mpg < 30) %>% to_duckdb() %>% group_by(cyl) %>% summarize(mean_mpg = mean(mpg, na.rm = TRUE)) %>% to_arrow() %>% collect()
  • Maintainer: Jonathan Keane
  • License: Apache License (>= 2.0)
  • Last published: 2025-02-26