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: Throw informative error for 0-width Array #18929

Conversation

coastalwhite
Copy link
Collaborator

This not only affects the example given in the issue but also just provides a generally better error.

Fixes #18921.

This not only affects the example given in the issue but also just provides a generally better error.

Fixes pola-rs#18921.
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Sep 25, 2024
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.86%. Comparing base (2467b27) to head (3d88b60).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18929      +/-   ##
==========================================
- Coverage   79.88%   79.86%   -0.02%     
==========================================
  Files        1521     1521              
  Lines      206850   206853       +3     
  Branches     2906     2906              
==========================================
- Hits       165243   165207      -36     
- Misses      41059    41098      +39     
  Partials      548      548              

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

@@ -372,6 +372,11 @@ impl Series {
pub fn cast_with_options(&self, dtype: &DataType, options: CastOptions) -> PolarsResult<Self> {
use DataType as D;

#[cfg(feature = "dtype-array")]
if matches!(dtype, D::Array(_, width) if *width == 0) {
Copy link
Member

@ritchie46 ritchie46 Sep 26, 2024

Choose a reason for hiding this comment

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

Can we fail a bit lower? Maybe in the array cast kernel?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I started looking yesterday at just implementing zero-width arrays. It is almost done so this PR is not really needed anymore.

Copy link
Member

Choose a reason for hiding this comment

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

Alright. Even better. :P

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.

Zero-sized Array caused panic exception
2 participants