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: Expressify str.json_path_match #15764

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

reswqa
Copy link
Collaborator

@reswqa reswqa commented Apr 19, 2024

Closes #15613.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Apr 19, 2024
fn json_path_match(&self, json_path: &StringChunked) -> PolarsResult<StringChunked> {
let ca = self.as_string();
match (ca.len(), json_path.len()) {
(_, 1) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should not let this branch merge with the following broadcast_try_binary_elementwise branch as we only need compile the json_path once.

broadcast_try_binary_elementwise(ca, json_path, |opt_str, opt_path| {
match (opt_str, opt_path) {
(Some(str_val), Some(path)) => {
PathCompiled::compile(path)
Copy link
Collaborator Author

@reswqa reswqa Apr 19, 2024

Choose a reason for hiding this comment

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

In theory, this could be further optimized with FastFixedCache, but PathCompile<'a>, unlike Regex, has a lifetime annotation making borrow checker unhappy. We should be able to find a way to make it work, but I think it make sense that we leave this for the next perf PR.

Copy link

codspeed-hq bot commented Apr 19, 2024

CodSpeed Performance Report

Merging #15764 will not alter performance

Comparing reswqa:expr_json_match_test (d3e783c) with main (0c2783a)

Summary

✅ 22 untouched benchmarks

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

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

Project coverage is 81.36%. Comparing base (0c2783a) to head (d3e783c).
Report is 1 commits behind head on main.

Files Patch % Lines
.../polars-ops/src/chunked_array/strings/json_path.rs 88.00% 3 Missing ⚠️
...rates/polars-plan/src/dsl/function_expr/strings.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15764      +/-   ##
==========================================
+ Coverage   81.35%   81.36%   +0.01%     
==========================================
  Files        1379     1379              
  Lines      176619   176640      +21     
  Branches     2544     2544              
==========================================
+ Hits       143686   143721      +35     
+ Misses      32449    32437      -12     
+ Partials      484      482       -2     

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

@reswqa reswqa marked this pull request as ready for review April 19, 2024 09:56
@ritchie46 ritchie46 merged commit 7540f98 into pola-rs:main Apr 19, 2024
26 checks passed
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 python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expressify parameter to Series/Expr.str.json_path_match
2 participants