Expressions result in different serializations across Python Polars PATCH version upgrades #16821
Open
2 tasks done
Labels
enhancement
New feature or an improvement of an existing feature
needs decision
Awaiting decision by a maintainer
python
Related to Python Polars
Checks
Reproducible example
Below is the Python code used to serialize the expression to JSON in different Polars versions:
Here are the versions of Polars in which the script was run, and their respective outputs of the serialized expression.
And here is the simplified code used to attempt to deserialize these JSON serializations:
Log output
Issue description
I noticed a few differences in the JSON serialization of a Polars Expression written in Python and serialized in different versions of Polars (
0.20.21
,0.20.22
and0.20.23
), and I was wondering if this is really intended, since it was a PATCH version upgrade (semver) and the JSONs serialized in0.20.21
or0.20.22
raised an error when I tried to deserialize them in0.20.23
(and vice versa). This issue with0.20.23
is also happening with the latest version0.20.31
.The differences between the JSONs from 0.20.21 and 0.20.22 don't seem to break the deserialization in each other's versions, as the expression serialized in
0.20.21
could still be deserialized in0.20.22
and vice versa.Now, between the JSONs from
0.20.22
and0.20.23
it seems there were more "critical" differences, since the deserialization broke in each other's versions with the following exception:polars.exceptions.ComputeError: could not deserialize input into an expression
Given this scenario, I'd like to know if this behavior is really intended. I'd also like to confirm if Polars Expressions serialized in Python Polars are safe to be deserialized and used in Rust Polars in a production environment. If so, is there a compatibility matrix between the Python and Rust releases, as they seem to be versioned differently (as of 2024-06-07, the latest version of Polars in PyPI is
0.20.31
while the latest version for Rust is0.40.0
)?Expected behavior
I expected the expressions serialization to JSON across all mentioned versions (0.20.21 through 0.20.23) to be the same and compatible with each other's version.
Installed versions
As mentioned previously, this issue considers different versions of the library (0.20.21, 0.20.22 and 0.20.23), but all of them will follow the same environment pasted below, with the only exception being the version of Polars itself.
The text was updated successfully, but these errors were encountered: