Skip to content

Commit

Permalink
add ipc pojection/memmap
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Sep 17, 2021
1 parent 75e0951 commit 4e9503f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion py-polars/polars/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def scan_parquet(
def read_ipc(
file: Union[str, BinaryIO, Path, bytes],
use_pyarrow: bool = True,
memory_map: bool = True,
columns: Optional[List[str]] = None,
storage_options: Optional[Dict] = None,
) -> "pl.DataFrame":
"""
Expand All @@ -414,6 +416,12 @@ def read_ipc(
If ``fsspec`` is installed, it will be used to open remote files
use_pyarrow
Use pyarrow or the native rust reader.
memory_map
Memory map underlying file. This will likely increase performance.
Only used when 'use_pyarrow==True'
columns
Columns to project/ select.
Only valid when 'use_pyarrow==True'
storage_options
Extra options that make sense for ``fsspec.open()`` or a particular storage connection, e.g. host, port, username, password, etc.
Expand All @@ -424,7 +432,7 @@ def read_ipc(
storage_options = storage_options or {}
with _prepare_file_arg(file, **storage_options) as data:
if use_pyarrow:
tbl = pa.feather.read_table(data)
tbl = pa.feather.read_table(data, memory_map=memory_map, columns=columns)
return pl.DataFrame.from_arrow(tbl)
return pl.DataFrame.read_ipc(data)

Expand Down

0 comments on commit 4e9503f

Please sign in to comment.