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(python): Panic on empty df / null List(Categorical) #16730

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

Object905
Copy link
Contributor

Fix: #16405

@github-actions github-actions bot added fix Bug fix python Related to Python Polars labels Jun 4, 2024
Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.44%. Comparing base (ddf8126) to head (34f1136).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16730      +/-   ##
==========================================
- Coverage   81.45%   81.44%   -0.01%     
==========================================
  Files        1413     1413              
  Lines      186096   186187      +91     
  Branches     2776     2776              
==========================================
+ Hits       151588   151645      +57     
- Misses      33988    34022      +34     
  Partials      520      520              

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

@@ -84,9 +84,12 @@ impl Series {
#[cfg(feature = "dtype-categorical")]
dt @ (Categorical(rev_map, ordering) | Enum(rev_map, ordering)) => {
let cats = UInt32Chunked::from_chunks(name, chunks);
let rev_map = rev_map
.clone()
.unwrap_or_else(|| Arc::new(RevMapping::default()));
Copy link
Member

Choose a reason for hiding this comment

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

We should assert cats is emtpy if we set an empty rev map.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe should add it directly in from_cats_and_rev_map_unchecked under cfg(debug_assertions)?
But this seems to be the only place when they're unwrapped, so I added it just here for now.

@ritchie46 ritchie46 merged commit 6db670d into pola-rs:main Jun 5, 2024
25 checks passed
@ritchie46
Copy link
Member

Thanks!

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
Projects
None yet
2 participants