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

feat(rust): Expose some more information in translated expression IR to python #17209

Merged
merged 4 commits into from
Jun 28, 2024

Conversation

wence-
Copy link
Collaborator

@wence- wence- commented Jun 26, 2024

Explicitly handle the options and hive partitioning in scans. I decided to use the serde-based serialization for the type-specific options in Scan rather than laboriously writing a translation for the options structs.

Question: does this need to be gated behind #[cfg(all(feature = "json", feature = "serde_json"))]? I think it's reasonable to require those features for the IR translation to function, but if we don't think so, I do stuff by hand.

Additionally, build out a bit more of the expression translation. The major one is that IRAggExprs now hold a Vec<Node> rather than a single Node as arguments, since Quantile takes two expressions.

wence- added 2 commits June 26, 2024 09:44
We needed to make a change to the arguments since Quantile has two
expressions as arguments, unlike all others. To solve this, change the
definition of the exposed Agg struct to take a Vec of nodes.
@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature rust Related to Rust Polars labels Jun 26, 2024
Comment on lines +298 to +300
return Err(PyNotImplementedError::new_err(
"scan with hive partitioning",
))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

previously we were silently discarding this information.

Comment on lines +330 to +326
let options = serde_json::to_string(options)
.map_err(|err| PyValueError::new_err(format!("{err:?}")))?;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is only enabled when the json feature is active (which it is in release builds I believe). I can gate and return Err in the case that it is not active (only the case for dev builds when trying to speed up compile cycles?)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is always enabled for release builds. I think this is fine. 👍

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 0% with 55 lines in your changes missing coverage. Please review.

Project coverage is 80.80%. Comparing base (df989de) to head (493e778).
Report is 4 commits behind head on main.

Files Patch % Lines
py-polars/src/lazyframe/visitor/expr_nodes.rs 0.00% 34 Missing ⚠️
py-polars/src/lazyframe/visitor/nodes.rs 0.00% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17209      +/-   ##
==========================================
- Coverage   80.84%   80.80%   -0.04%     
==========================================
  Files        1465     1466       +1     
  Lines      192042   192263     +221     
  Branches     2745     2745              
==========================================
+ Hits       155252   155359     +107     
- Misses      36285    36401     +116     
+ Partials      505      503       -2     

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

@wence- wence- force-pushed the wence/fea/agg-quantile branch from f203b74 to 8a5098c Compare June 26, 2024 14:14
wence- added 2 commits June 26, 2024 14:16
Necessary particularly for CSV where the options select the delimiter
and so forth.

Rather than hand-coding the options serialization, just use the serde
representation for this case.
We were previously silently ignoring this, which is the wrong thing.
@wence- wence- force-pushed the wence/fea/agg-quantile branch from 8a5098c to 493e778 Compare June 26, 2024 14:19
py-polars/src/lazyframe/visitor/expr_nodes.rs Show resolved Hide resolved
Comment on lines +330 to +326
let options = serde_json::to_string(options)
.map_err(|err| PyValueError::new_err(format!("{err:?}")))?;
Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is always enabled for release builds. I think this is fine. 👍

@ritchie46 ritchie46 merged commit e50a2c4 into pola-rs:main Jun 28, 2024
17 checks passed
@wence- wence- deleted the wence/fea/agg-quantile branch June 28, 2024 08:10
@wence-
Copy link
Collaborator Author

wence- commented Jun 28, 2024

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants