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: Properly raise on invalid selector expressions #18511

Merged
merged 1 commit into from
Sep 2, 2024
Merged

Conversation

stinodego
Copy link
Member

Closes #18499

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Sep 2, 2024
)

with pytest.raises(InvalidOperationError, match="invalid selector expression"):
lf.unique(subset=[["bar", "ham"]])
Copy link
Member

Choose a reason for hiding this comment

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

What kind of expression does this lead to in crates/polars-plan/src/plans/conversion/expr_expansion.rs:L928?

Copy link
Member Author

@stinodego stinodego Sep 2, 2024

Choose a reason for hiding this comment

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

The input is parsed as a list with one element: a String Series with two elements ("bar", "ham"). Which is "correct", just not valid input for selector expansion.

So it becomes a Literal, not a Column.

Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.89%. Comparing base (4dc90a9) to head (6f8d752).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18511      +/-   ##
==========================================
+ Coverage   79.87%   79.89%   +0.01%     
==========================================
  Files        1501     1501              
  Lines      202032   202029       -3     
  Branches     2868     2868              
==========================================
+ Hits       161370   161405      +35     
+ Misses      40115    40077      -38     
  Partials      547      547              

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

@stinodego stinodego marked this pull request as ready for review September 2, 2024 08:19
@ritchie46 ritchie46 merged commit 7168479 into main Sep 2, 2024
26 checks passed
@ritchie46 ritchie46 deleted the expand-selector branch September 2, 2024 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unreachable code panic on invalid argument for unique
2 participants