Repository navigation
feat: Implement dt.{replace,convert}_time_zone, dt.timestamp, join_asof, windowed first/last; fix over and null edge cases - #149
Merged
jonasdedden merged 4 commits intoNov 15, 2026
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This was referenced Nov 10, 2026
MarcoGorelli
approved these changes
Nov 13, 2026
jonasdedden
force-pushed
the
feat/dt-tz-join-asof-first-last
branch
from
November 15, 2026 14:12
3b75add to
5e59db9
Compare
jonasdedden
added a commit
to jonasdedden/narwhals-daft
that referenced
this pull request
Nov 15, 2026
The previous floor (0.5.18) was stale: main already needs 0.7.13 (median, percentile, concat_ws, struct literals) and the windowed first/last and join_asof(strategy='nearest') in narwhals-dev#149 need 0.7.15.
jonasdedden
force-pushed
the
feat/dt-tz-join-asof-first-last
branch
from
November 15, 2026 14:34
5e59db9 to
33c5fc0
Compare
…st; fix any/all/n_unique over, is_in nulls, str.slice, strip_chars and more
Daft already keeps null input as null when the list holds no null.
jonasdedden
force-pushed
the
feat/dt-tz-join-asof-first-last
branch
from
November 15, 2026 15:07
31b30c2 to
7a5d727
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires up functionality Daft already has natively, plus a few small semantic fixes.
New:
dt.replace_time_zone/dt.convert_time_zoneviaF.replace_time_zone/F.convert_time_zone. Naive input toconvert_time_zoneis treated as UTC, like Polars;from_timezoneis ignored for tz-aware input.dt.timestampviaF.to_unix_epoch. Non-temporal input raisesTypeError("Input should be either of Date or Datetime type"), like the other backends; the check resolves the dtype against the frame at plan time.LazyFrame.join_asofviaDataFrame.join_asof. Its key,byand suffix handling already matches Polars, so it's a pass-through.first/lastwithinover(and broadcast inwith_columns) viaF.first_value/F.last_value. These need an explicit unboundedrows_betweenframe. As a plain aggregation (select,group_by) they raiseNotImplementedError, because Daft has no ordered aggregate.Fixes:
any/all/n_uniqueinsideover: Daft only accepts a bare aggregation as the window expression, socoalesce/+now wrap the windowed aggregations rather than the other way round.is_inwith nulls inother: Daft returns null for every non-match onceothercontains a null.-usesF.negate.str.slice: a negative offset reaching before the start errored in Daft. It's now clipped, with an explicitlengthshortened by the overhang, as Polars does. Empty results are""instead of null.str.strip_chars(characters)reuses the escaped character-class regex fromstrip_chars_{start,end}, and an emptycharactersis a no-op.list.uniqueacceptsmaintain_order.Trueraises, becauselist_distinctdrops nulls and they are re-appended at the end.with_row_index(order_by=...)puts nulls first and staysUInt64(row_number() - 1used to promote toFloat64).Requires #147 (pin update) first, and is independent of #148. Both PRs touch the exclusion list in
run_tests.py, so whichever merges second needs a trivial rebase. On top of #147: 309 → 244 failures on the full suite, no new failures, and 28 names dropped fromrun_tests.py.Update (performance review):
is_innow skips the null guard (when) unless the filtered list is empty. Daft already keeps null input as null when the list has no null, sois_innow runs at the speed of Daft's ownis_in. In a 5M-row benchmark, every other new or changed expression here also runs at native speed:first/lastvsfirst_value;any/all/n_uniqueover windows;timestamp;join_asof;-.Note
I used Claude (Opus 5.5) to help with these changes and this description.