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: add time_unit argument to duration, default to "us" #11586

Merged
merged 3 commits into from
Oct 8, 2023

Conversation

MarcoGorelli
Copy link
Collaborator

closes #10868

@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 Oct 7, 2023
@@ -185,6 +185,7 @@ def duration(
minutes: Expr | str | int | None = None,
hours: Expr | str | int | None = None,
weeks: Expr | str | int | None = None,
time_unit: TimeUnit = "ns",
Copy link
Collaborator Author

@MarcoGorelli MarcoGorelli Oct 7, 2023

Choose a reason for hiding this comment

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

isn't the default time unit usually "us" in Polars?

I'm setting it as "ns" here to preserve backwards compatibility, but (separately) it may be worth considering "us" as the default? this would also reduce the likelihood of overflows like the one reported in the linked issue

Copy link
Member

@ritchie46 ritchie46 Oct 8, 2023

Choose a reason for hiding this comment

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

Yes, it is. We should set this to us. I consider this a bug fix.

@MarcoGorelli MarcoGorelli marked this pull request as ready for review October 7, 2023 19:41
@MarcoGorelli MarcoGorelli changed the title feat(rust, python): add time_unit argument to duration feat(rust, python)!: add time_unit argument to duration, default to "us" Oct 8, 2023
@github-actions github-actions bot added the breaking Change that breaks backwards compatibility label Oct 8, 2023
@ritchie46 ritchie46 merged commit 0063597 into pola-rs:main Oct 8, 2023
26 checks passed
@stinodego stinodego changed the title feat(rust, python)!: add time_unit argument to duration, default to "us" feat: add time_unit argument to duration, default to "us" Oct 8, 2023
@stinodego stinodego removed the breaking Change that breaks backwards compatibility label Oct 8, 2023
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.

Strange behavior of pl.duration
3 participants