Skip to content

fix: dtype-aware is_nan, median, skew; explode errors - #151

Merged
jonasdedden merged 2 commits into
narwhals-dev:mainfrom
jonasdedden:fix/dtype-aware-errors
Nov 15, 2026
Merged

jonasdedden merged 2 commits into
narwhals-dev:mainfrom
jonasdedden:fix/dtype-aware-errors

Conversation

@jonasdedden

Copy link
Copy Markdown
Member

Uses the frame's schema (DaftLazyFrame._native_dtype, plan-time only) where behaviour depends on the input dtype. Adds DaftExpr._with_callable_frame, the aggregation counterpart of _with_elementwise_frame.

  • is_nan on integer columns returns False (null for null), as in Polars. Daft's is_nan only accepts floats, so it raised before. Other non-float input still raises.
  • median on non-numeric input raises InvalidOperationError("median operation not supported for non-numeric input type."), the same message as the other backends.
  • skew of an empty or all-null column, which has the Null dtype that Daft rejects, is cast to Float64 first and returns null.
  • explode: a non-list column raises the same InvalidOperationError as DuckDB/Ibis. Daft's collect-time "list length did not match" is translated to a ShapeError. To stay within ruff's return-count limit, catch_daft_exception now picks the error class first and returns once.

Stacked on #148, which switches is_nan to F.is_nan. On top of it: 6 more cases pass, there are no new failures, and 5 names are dropped from run_tests.py. The matching dt.timestamp check on non-temporal input went into #149, where dt.timestamp is implemented.

Note

I used Claude (Opus 5.5) to help with these changes and this description.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 04a7fdf8-45d6-488b-9869-685470f807ec
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@MarcoGorelli MarcoGorelli 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.

thanks @jonasdedden

I've approved all these PRs, feel free to merge them all once merge conflicts are resolved

@jonasdedden
jonasdedden force-pushed the fix/dtype-aware-errors branch from 25a4abb to 49af22c Compare November 15, 2026 14:12
@jonasdedden
jonasdedden force-pushed the fix/dtype-aware-errors branch from 49af22c to e54834d Compare November 15, 2026 14:34
@jonasdedden
jonasdedden merged commit 8d90f73 into narwhals-dev:main Nov 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants