fix(rust, python): fix result dtype in date_range(..., eager=True) if duration contains "1s1d" #9670
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On the way towards #9019
closes #9665
ideally, to be rebased onto #8591Sorry for all the tests, my hope is that extensive tests now will mean fewer regression tests in the future 🤞
Summary:
Instead of doing
I'm doing
In order for that to work, I've had to align the lazy and eager paths a bit more. For example, in the eager mode, currently, a date range of
date
s with sub-daily precision results in a date_range ofdatetime
s:polars/py-polars/polars/functions/range.py
Lines 575 to 580 in f1470c2
That logic was not present in the lazy date range, so I've added it.
The extra
.explode
really makes the issue raised in #9019 glaringly obvious - but this is a first step towards resolving it!Also - this started off as an attempt to refactor, the fact that it picked up (and ended up solving) #9665 was just a fortunate find along the way 😄