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: Propagate error instead of panicking when calling product on an invalid type #15093

Merged
merged 1 commit into from
Mar 16, 2024

Conversation

petrosbar
Copy link
Contributor

Prevent the following from panicking:

import polars as pl

pl.Series("", [[1, 2]]).product()
# PanicException: product not supported for dtype: List(Int64)

and instead make it behave like:

pl.Series("", [[1, 2]]).sum()
# InvalidOperationError: `sum` operation not supported for dtype `list[i64]`

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Mar 16, 2024
Copy link

codecov bot commented Mar 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.06%. Comparing base (5d449cc) to head (2fd088e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15093   +/-   ##
=======================================
  Coverage   81.06%   81.06%           
=======================================
  Files        1342     1342           
  Lines      173935   173942    +7     
  Branches     2459     2459           
=======================================
+ Hits       141000   141009    +9     
+ Misses      32468    32466    -2     
  Partials      467      467           

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

Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

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

Thank you!

@ritchie46 ritchie46 merged commit be92470 into pola-rs:main Mar 16, 2024
24 checks passed
@petrosbar petrosbar deleted the product-panic branch March 16, 2024 09:45
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.

2 participants