Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loading pickled pl.Series of dtype=pl.Array(pl.Enum(...), ...) fails #18810

Closed
2 tasks done
egorchakov opened this issue Sep 18, 2024 · 0 comments · Fixed by #19077
Closed
2 tasks done

loading pickled pl.Series of dtype=pl.Array(pl.Enum(...), ...) fails #18810

egorchakov opened this issue Sep 18, 2024 · 0 comments · Fixed by #19077
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@egorchakov
Copy link
Contributor

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import pickle  # noqa: S403

import polars as pl

series = pl.Series(values=[["a"]], dtype=pl.Array(pl.Enum(["a"]), shape=1))
dumped = pickle.dumps(series)
loaded = pickle.loads(dumped)

Log output

Traceback (most recent call last):
  File "[...]/issue.py", line 7, in <module>
    loaded = pickle.loads(dumped)
             ^^^^^^^^^^^^^^^^^^^^
  File "[...]/.venv/lib/python3.12/site-packages/polars/series/series.py", line 646, in __setstate__
    self._s.__setstate__(state)
polars.exceptions.ComputeError: Dictionary id 0 not found. Valid ids: {}

Issue description

I've been using pl.List as a workaround for the time being.

Expected behavior

pickle.loads succeeds

Installed versions

--------Version info---------
Polars:              1.7.1
Index type:          UInt32
Platform:            Linux-6.2.0-33-generic-x86_64-with-glibc2.35
Python:              3.12.4 (main, Jul 25 2024, 22:42:01) [Clang 18.1.8 ]

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
cloudpickle          3.0.0
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               2024.9.0
gevent               <not installed>
great_tables         <not installed>
matplotlib           3.9.2
nest_asyncio         <not installed>
numpy                1.26.4
openpyxl             <not installed>
pandas               <not installed>
pyarrow              17.0.0
pydantic             2.9.2
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                2.4.1+cu121
xlsx2csv             <not installed>
xlsxwriter           <not installed>
@egorchakov egorchakov added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant