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(rust): avoid panic when projecting solitary count into empty frame #17393

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

wence-
Copy link
Collaborator

@wence- wence- commented Jul 3, 2024

When the schema of a frame is empty, a count expression is still valid since it does not refer to any columns. In this scenario, selecting the "last" column in the schema would previously panic, since there are none. Fix this by handling this edge case explicitly.

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.73%. Comparing base (d13efa5) to head (ef48b6f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17393      +/-   ##
==========================================
- Coverage   80.74%   80.73%   -0.02%     
==========================================
  Files        1475     1475              
  Lines      193389   193392       +3     
  Branches     2760     2760              
==========================================
- Hits       156146   156127      -19     
- Misses      36733    36755      +22     
  Partials      510      510              

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

When the schema of a frame is empty, a count expression is still valid
since it does not refer to any columns. In this scenario, selecting
the "last" column in the schema would previously panic, since there
are none. Fix this by handling this edge case explicitly.

- Closes pola-rs#16904
@ritchie46 ritchie46 merged commit d6c797a into pola-rs:main Jul 3, 2024
24 of 25 checks passed
@wence- wence- deleted the wence/fix/16904 branch July 3, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic when selecting len from empty dataframe with projection_pushdown
2 participants