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

feat: Polish decimal arithmetic #14172

Merged
merged 7 commits into from
Feb 3, 2024
Merged

Conversation

flisky
Copy link
Contributor

@flisky flisky commented Feb 1, 2024

  • arithmetics with different scales
  • mul/div following arrow-rs behaivers
  • remove legacy arithmetics

fixup #9123

@stinodego stinodego changed the title polish decimal arithmetics feat: Polish decimal arithmetic Feb 1, 2024
@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Feb 1, 2024
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.

Nice! This is a great cleanup!

|lhs, rhs_val| decimal::div_scalar(lhs, rhs_val, &rhs.dtype().to_arrow(true)),
|lhs_val, rhs| decimal::div_scalar_swapped(lhs_val, &self.dtype().to_arrow(true), rhs),
)
// Follow postgres and MySQL adding a fixed scale increment of 4
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. And then they accept that after a few multiplication it simply doesn't fit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ritchie46 ritchie46 merged commit ec72aec into pola-rs:main Feb 3, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature 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