Skip to content

Support pl.Expr.dt.quarter - #23157

Merged
rapids-bot[bot] merged 3 commits into
NVIDIA:mainfrom
mroeschke:cudf_polars/enh/dt_quarter
Jul 9, 2026
Merged

Support pl.Expr.dt.quarter#23157
rapids-bot[bot] merged 3 commits into
NVIDIA:mainfrom
mroeschke:cudf_polars/enh/dt_quarter

Conversation

@mroeschke

Copy link
Copy Markdown
Contributor

Description

xref #23151

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke self-assigned this Jul 7, 2026
@mroeschke
mroeschke requested a review from a team as a code owner July 7, 2026 22:34
@mroeschke
mroeschke requested a review from pentschev July 7, 2026 22:34
@mroeschke mroeschke added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jul 7, 2026
@github-actions github-actions Bot added Python Affects Python cuDF API. cudf-polars Issues specific to cudf-polars labels Jul 7, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python Jul 7, 2026
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1d5f9d40-43c9-4e0e-890c-7994429471d7

📥 Commits

Reviewing files that changed from the base of the PR and between 1fd7e48 and 332a86a.

📒 Files selected for processing (2)
  • python/cudf_polars/cudf_polars/dsl/expressions/datetime.py
  • python/cudf_polars/tests/expressions/test_datetime_basic.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • python/cudf_polars/tests/expressions/test_datetime_basic.py
  • python/cudf_polars/cudf_polars/dsl/expressions/datetime.py

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for extracting the quarter from Date and Datetime values.
    • Works across supported datetime resolutions (ms/us/ns) and returns correct results for nullable inputs.
  • Tests
    • Added GPU-backed test coverage to verify .dt.quarter() for Date and Datetime types, including null handling, by comparing results against expected output.

Walkthrough

Adds support for the Quarter temporal operation in TemporalFunction, including evaluation via extract_quarter and a new parametrized test covering Date and Datetime dtypes.

Changes

Quarter Temporal Function Support

Layer / File(s) Summary
Quarter operation implementation and validation
python/cudf_polars/cudf_polars/dsl/expressions/datetime.py, python/cudf_polars/tests/expressions/test_datetime_basic.py
Quarter is added to _valid_ops, evaluated through plc.datetime.extract_quarter with a cast to the target dtype, and covered by a new parametrized .dt.quarter() test across Date and Datetime inputs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • rapidsai/cudf#18443: Both PRs extend TemporalFunction with new _valid_ops entries and do_evaluate branches for temporal operations, with corresponding tests in test_datetime_basic.py.
  • rapidsai/cudf#23153: Both PRs add a new .dt.* operation to TemporalFunction and validate it with GPU tests in test_datetime_basic.py.
  • rapidsai/cudf#23154: Both PRs update the same TemporalFunction datetime expression handling with a new temporal extraction path and test coverage.

Suggested reviewers: bdice, rjzamora

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly matches the main change: adding support for pl.Expr.dt.quarter.
Description check ✅ Passed The description references the linked issue and is clearly about the same quarter-support change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@Matt711 Matt711 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you keep #16481 updated as you go?

@mroeschke

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 0ef8b55 into NVIDIA:main Jul 9, 2026
108 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Jul 9, 2026
@mroeschke
mroeschke deleted the cudf_polars/enh/dt_quarter branch July 9, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants