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

refactor: make dsl immutable and cheap to clone #15394

Merged
merged 3 commits into from
Mar 30, 2024

Conversation

orlp
Copy link
Collaborator

@orlp orlp commented Mar 29, 2024

No description provided.

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars labels Mar 29, 2024
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

Attention: Patch coverage is 88.83929% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 81.25%. Comparing base (cf4df74) to head (5362a9f).

Files Patch % Lines
crates/polars-utils/src/functions.rs 50.00% 16 Missing ⚠️
crates/polars-plan/src/logical_plan/iterator.rs 73.33% 4 Missing ⚠️
crates/polars-plan/src/logical_plan/projection.rs 96.55% 2 Missing ⚠️
crates/polars-lazy/src/physical_plan/exotic.rs 83.33% 1 Missing ⚠️
...s/polars-plan/src/dsl/functions/syntactic_sugar.rs 0.00% 1 Missing ⚠️
crates/polars-sql/src/context.rs 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15394      +/-   ##
==========================================
- Coverage   81.26%   81.25%   -0.02%     
==========================================
  Files        1361     1361              
  Lines      174713   174731      +18     
  Branches     2531     2531              
==========================================
- Hits       141989   141972      -17     
- Misses      32240    32273      +33     
- Partials      484      486       +2     

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

Arc::make_mut(&mut arc);

// If f panics we must be able to drop the Arc without assuming it is initialized.
let mut uninit_arc = Arc::from_raw(Arc::into_raw(arc).cast::<MaybeUninit<T>>());
Copy link
Member

Choose a reason for hiding this comment

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

Does panicking change the repr of T?

Copy link
Collaborator Author

@orlp orlp Mar 30, 2024

Choose a reason for hiding this comment

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

@ritchie46 When an Arc gets dropped due to the panic unwinding it drops the value inside the arc (if it was the last reference). But since we temporarily take out the value using ptr::read that would be invalid and could lead to double drops. So we change toMaybeUninit temporarily which has a no-op drop for the value inside the Arc.

@ritchie46 ritchie46 merged commit be41697 into pola-rs:main Mar 30, 2024
18 checks passed
@c-peters c-peters added the accepted Ready for implementation label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation internal An internal refactor or improvement 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