Skip to content

Support pl.Expr.dt.date - #23155

Merged
rapids-bot[bot] merged 4 commits into
NVIDIA:mainfrom
mroeschke:cudf_polars/enh/dt_date
Jul 21, 2026
Merged

Support pl.Expr.dt.date#23155
rapids-bot[bot] merged 4 commits into
NVIDIA:mainfrom
mroeschke:cudf_polars/enh/dt_date

Conversation

@mroeschke

@mroeschke mroeschke commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

xref #23151

https://docs.pola.rs/api/python/dev/reference/expressions/api/polars.Expr.dt.date.html

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:32
@mroeschke
mroeschke requested a review from Matt711 July 7, 2026 22:32
@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

📝 Walkthrough

Walkthrough

This PR adds GPU support for dt.date() in TemporalFunction by accepting Date as a valid temporal op and evaluating it through a cast to the date storage type. It also adds parameterized test coverage across multiple datetime units.

Changes

Date Temporal Function Support

Layer / File(s) Summary
Date op validation and evaluation
python/cudf_polars/cudf_polars/dsl/expressions/datetime.py
TemporalFunction.Name.Date is added to _valid_ops, and do_evaluate gains a branch casting the input column to self.dtype.plc_type to drop the sub-day component.
Date function test coverage
python/cudf_polars/tests/expressions/test_datetime_basic.py
New parameterized test_datetime_date test verifies .dt.date() GPU results across ms/us/ns datetime dtypes, including a pre-epoch datetime and a None value.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • rapidsai/cudf#18443: Both PRs extend TemporalFunction in the same file by adding new ops to _valid_ops and new do_evaluate branches with matching test additions.
  • rapidsai/cudf#22754: Both PRs modify TemporalFunction evaluation control flow for a temporal transform and add corresponding coverage in the datetime expression tests.

Suggested reviewers: vyasr, bdice

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding support for pl.Expr.dt.date.
Description check ✅ Passed The description is related to the change and links the relevant issue and API docs.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@vyasr

vyasr commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit 1fe5828 into NVIDIA:main Jul 21, 2026
152 of 155 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Jul 21, 2026
@mroeschke
mroeschke deleted the cudf_polars/enh/dt_date branch July 21, 2026 17:11
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

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants