Skip to content

feat(expr-ir): Add date_range, support {date,int}_range(eager=...)#3294

Merged
dangotbanned merged 11 commits intooh-nodesfrom
expr-ir/more-range
Nov 8, 2025
Merged

feat(expr-ir): Add date_range, support {date,int}_range(eager=...)#3294
dangotbanned merged 11 commits intooh-nodesfrom
expr-ir/more-range

Conversation

@dangotbanned
Copy link
Member

What type of PR is this? (check all applicable)

  • ✨ Feature

Related issues

Description

date_range was spun out from (#2895 (comment)).
Currently supporting day/week intervals only. Month/quarter/year would need dedicated support from the backend.

eager=... is adapted from #2895.
The main improvement here is in the typing:

from typing import Any
from typing_extensions import assert_type
import pyarrow as pa
import narwhals._plan as nwp

expr = nwp.int_range(0, 10)
series = nwp.int_range(0, 10, eager="pyarrow")

assert_type(expr, "nwp.Expr")  # ✔️
assert_type(series, "nwp.Series[Any]")  # ❌ "assert_type" mismatch: expected "Series[Any]" but received "Series[ChunkedArray[Any]]" Pylance(reportAssertTypeFailure)
assert_type(series, "nwp.Series[pa.ChunkedArray[Any]]")  # ✔️

Mostly just re-purposing `int_range` *so far*, as mentioned in (#2895 (comment))

Need to think about `Interval` some more
Barely started covering this one
`timedelta` supports `{"d","w"}`, but not `{"mo","q","y"}`
Started working on this, but doesn't reduce the amount of code yet
@dangotbanned dangotbanned added enhancement New feature or request internal pyarrow Issue is related to pyarrow backend labels Nov 8, 2025
@dangotbanned dangotbanned marked this pull request as ready for review November 8, 2025 16:29
@dangotbanned dangotbanned merged commit 80126e0 into oh-nodes Nov 8, 2025
33 of 34 checks passed
@dangotbanned dangotbanned deleted the expr-ir/more-range branch November 8, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request internal pyarrow Issue is related to pyarrow backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant