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

fix: Ensure Python version matches version used to serialize credential provider #19375

Merged
merged 4 commits into from
Oct 22, 2024

Conversation

nameexhaustion
Copy link
Collaborator

No description provided.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Oct 22, 2024
ser_py_version
"current Python version {:?} does not match the Python version used to serialize the UDF {:?}",
(3, cur_py_version[0], cur_py_version[1]),
(3, ser_py_version[0], ser_py_version[1] )
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to also check the micro version - from research pickle requires the exact same Python version.

was added from #19175

@@ -141,8 +141,8 @@ impl ColumnsUdf for PythonUdfExpression {
.getattr("dumps")
.unwrap();
let pickle_result = pickle.call1((self.python_function.clone_ref(py),));
let (dumped, use_cloudpickle, py_version) = match pickle_result {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still serialize the correct Python version even if we are using cloudpickle

@@ -57,14 +57,14 @@ impl PythonUdfExpression {
// Handle pickle metadata
let use_cloudpickle = buf[0];
if use_cloudpickle != 0 {
Copy link
Collaborator Author

@nameexhaustion nameexhaustion Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this, but the existing code for PythonUDF deserialization doesn't enforce the Python version equality if it was serialized with cloudpickle. Maybe we should?

@nameexhaustion nameexhaustion changed the title fix: Ensure Python version matches serialized credential provider fix: Ensure Python version matches version used to serialize credential provider Oct 22, 2024
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 89.04110% with 16 lines in your changes missing coverage. Please review.

Project coverage is 80.21%. Comparing base (27289b2) to head (3f22305).
Report is 62 commits behind head on main.

Files with missing lines Patch % Lines
crates/polars-utils/src/python_function.rs 89.07% 13 Missing ⚠️
crates/polars-plan/src/dsl/python_udf.rs 72.72% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19375      +/-   ##
==========================================
+ Coverage   80.18%   80.21%   +0.02%     
==========================================
  Files        1523     1523              
  Lines      209897   209999     +102     
  Branches     2434     2434              
==========================================
+ Hits       168314   168441     +127     
+ Misses      41028    41002      -26     
- Partials      555      556       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nameexhaustion nameexhaustion marked this pull request as ready for review October 22, 2024 11:05
@ritchie46 ritchie46 merged commit bdfe4c7 into pola-rs:main Oct 22, 2024
25 checks passed
@nameexhaustion nameexhaustion deleted the pyfunc-serde branch October 28, 2024 04:54
@c-peters c-peters added the accepted Ready for implementation label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants