Skip to content

Commit

Permalink
Dont pickle _scan_impl`
Browse files Browse the repository at this point in the history
  • Loading branch information
cjackal committed Jul 30, 2023
1 parent 868f6e5 commit 25d5179
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions py-polars/polars/io/ipc/anonymous_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import polars._reexport as pl
import polars.io.ipc
from polars.dependencies import pickle
from polars.io._utils import _prepare_file_arg

if TYPE_CHECKING:
Expand All @@ -17,13 +16,12 @@ def _scan_ipc_fsspec(
storage_options: dict[str, object] | None = None,
) -> LazyFrame:
func = partial(_scan_ipc_impl, source, storage_options=storage_options)
func_serialized = pickle.dumps(func)

storage_options = storage_options or {}
with _prepare_file_arg(source, **storage_options) as data:
schema = polars.io.ipc.read_ipc_schema(data)

return pl.LazyFrame._scan_python_function(schema, func_serialized)
return pl.LazyFrame._scan_python_function(schema, func)


def _scan_ipc_impl( # noqa: D417
Expand Down
4 changes: 1 addition & 3 deletions py-polars/polars/io/parquet/anonymous_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import polars._reexport as pl
import polars.io.parquet
from polars.dependencies import pickle
from polars.io._utils import _prepare_file_arg

if TYPE_CHECKING:
Expand All @@ -17,13 +16,12 @@ def _scan_parquet_fsspec(
storage_options: dict[str, object] | None = None,
) -> LazyFrame:
func = partial(_scan_parquet_impl, source, storage_options=storage_options)
func_serialized = pickle.dumps(func)

storage_options = storage_options or {}
with _prepare_file_arg(source, **storage_options) as data:
schema = polars.io.parquet.read_parquet_schema(data)

return pl.LazyFrame._scan_python_function(schema, func_serialized)
return pl.LazyFrame._scan_python_function(schema, func)


def _scan_parquet_impl( # noqa: D417
Expand Down

0 comments on commit 25d5179

Please sign in to comment.