-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add to_pyarrow and to_pyarrow_batches
Adds `to_pyarrow` and `to_pyarrow_batches` to the `BaseBackend`. `to_pyarrow` returns pyarrow objects consistent with the dimension of the output: - a table -> pa.Table - a column -> pa.Array - a scalar -> pa.Scalar `to_pyarrow_batches` returns a RecordBatchReader that returns batches of pyarrow tables. It does not have the same dimension handling because that is not available in RecordBatchReaders. `to_pyarrow_batches` is implemented for `AlchemyBackend`, `datafusion`, and `duckdb`. The `pandas` backend has `to_pyarrow` implemented by using `pandas.DataFrame.to_pyarrow()`. Backends that do not require pyarrow already will only require it when using to_pyarrow* methods. There are warnings on these methods to indicate that they are experimental and that they may break in the future irrespective of semantic versioning. The DuckDB `to_pyarrow_batches` makes use of a proxy object to escape garbage collection so that the underlying record batches are still available even after the `cursor` used to generate them _would have_ been garbage collected (but isn't because it is embedded in the proxy object)
- Loading branch information
Showing
9 changed files
with
542 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.