Repository navigation
Raise when a time cannot be represented in nanoseconds - #1290
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48fe281db4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #1290 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 225 225
Lines 36589 36644 +55
=========================================
+ Hits 36589 36644 +55
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Comparing Footnotes
|
Description
Fixes #890. Replaces #927 by @manduinca, whose PR mapped every spelling that wrapped and whose cases the tests here reuse; thank you.
dc.to_datetime64anddc.to_timedelta64silently wrapped or saturated values outside the nanosecond range:to_datetime64("2500-01-01")returned 1915-06-14,np.array([2e10])saturated,"2500"(parsed in years) wrapped through the calendar. They now raiseTimeOverflowError, which is both aTimeErrorand anOverflowError, so existing handlers keep working.How:
_as_ns, which bounds the integer count for its unit before casting. Numpy 2.5 raises on such casts but 2.3.3 (our floor) wraps, so the bound is explicit. Datetime years and months go through days first.dateinput now goes through the string path, replacing its own check.pd.Timestamp,pd.Timedeltaand duration strings now come back in ns rather than their own unit.spool.selectwith an unrepresentable date string bound raises instead of falling back to a string comparison that matched nothing.Behaviour changes worth knowing:
patch.select(time=(None, "3000-01-01"))raises; ondevit silently returned an empty patch.Not covered: pandas string arrays parse with
errors="coerce", so a value pandas itself cannot hold becomes NaT as before (catching it needs a per-element reparse); a list mixing datetime64 units is promoted by numpy before conversion; Pythontimedeltas beyond ~292,000 years wrap inside numpy's own constructor.Performance:
patch.selectis unchanged (~360 µs). Scalar conversions of strings and non-ns datetimes cost ~2.5 µs instead of ~0.4 µs; ns scalars ~0.5 µs.Tested on numpy 2.5.3 and 2.3.3.
Changelog
dc.to_datetime64anddc.to_timedelta64raiseTimeOverflowErrorfor a time outside the nanosecond range instead of returning a wrapped or saturated one.Checklist
I have:
dascore/docs/contributing/general_guidelines.qmd).I have (if applicable):