Repository navigation
Conversation
|
Warning Review limit reached
Next review available in: 62 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
ChangesArrow duration component extraction
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
pandas/core/arrays/arrow/array.py (2)
3908-3909: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCompute the day quotient and remainder once.
self._dt_daysperforms the cast and floor division._dt_day_remainderthen repeats the same work. This makes everySeries.dt.componentscall compute the day decomposition twice. Cache the day quotient and remainder together, then reuse both results here.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pandas/core/arrays/arrow/array.py` around lines 3908 - 3909, Update the datetime components construction around _dt_days and _dt_day_remainder to compute the day quotient and remainder together once, cache both values, and reuse them for the "days" component and remainder processing instead of invoking both properties independently.
3923-3925: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winSkip the final remainder update.
After the last available component for the selected duration unit, Line 3925 assigns a remainder that the loop never reads. This still allocates
pc.multiplyandpc.subtractresults. Use the current remainder directly when the divisor is1, or guard the update when no finer component exists.Proposed localized fix
if divisor is None: # array resolution is coarser than this component -> always 0 components[name] = self._dt_zero_or_null_int32() continue + if divisor == 1: + components[name] = self._from_pyarrow_array( + remainder.cast(pa.int32()) + ) + continue value = pc.divide(remainder, divisor) components[name] = self._from_pyarrow_array(value.cast(pa.int32())) remainder = pc.subtract(remainder, pc.multiply(value, divisor))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pandas/core/arrays/arrow/array.py` around lines 3923 - 3925, Update the component-processing loop around value, components, and remainder so the final available duration component does not perform an unused remainder update. When divisor is 1, retain the current remainder directly; otherwise only execute pc.multiply and pc.subtract when a finer component remains, preserving existing component values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@doc/source/whatsnew/v3.1.0.rst`:
- Line 361: Update the issue reference in the Series.dt.components ArrowDtype
duration performance bullet to use tracking number 66635 instead of 63283,
leaving the description unchanged.
---
Nitpick comments:
In `@pandas/core/arrays/arrow/array.py`:
- Around line 3908-3909: Update the datetime components construction around
_dt_days and _dt_day_remainder to compute the day quotient and remainder
together once, cache both values, and reuse them for the "days" component and
remainder processing instead of invoking both properties independently.
- Around line 3923-3925: Update the component-processing loop around value,
components, and remainder so the final available duration component does not
perform an unused remainder update. When divisor is 1, retain the current
remainder directly; otherwise only execute pc.multiply and pc.subtract when a
finer component remains, preserving existing component values.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 84d9cd2d-d70e-4bf1-9af9-0ec1034a308d
📒 Files selected for processing (2)
doc/source/whatsnew/v3.1.0.rstpandas/core/arrays/arrow/array.py
5e4f543 to
56632f7
Compare
3d07137 to
e975485
Compare
de56a49 to
1096988
Compare
43ae4ae to
aa8f7e4
Compare
Mirror of pandas-dev/pandas#66635. Runs the pandas test suite through dagz.
Summary by CodeRabbit