We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
DuckDBExpr.first
1 parent 68fdfe8 commit ecaca9aCopy full SHA for ecaca9a
narwhals/_duckdb/expr.py
@@ -495,11 +495,12 @@ def _clip_both(
495
496
@requires.backend_version((1, 3))
497
def first(self) -> Self:
498
- def fn(inputs: DuckDBWindowInputs) -> Expression:
+ def fn(df: DuckDBLazyFrame, inputs: DuckDBWindowInputs) -> Sequence[Expression]:
499
order_by = generate_order_by_sql(*inputs.order_by, ascending=True)
500
partition_by = generate_partition_by_sql(*inputs.partition_by)
501
window = f"({partition_by} {order_by})"
502
- return SQLExpression(f"first({inputs.expr}) over {window}")
+ sql = f"first({{expr}}) over {window}"
503
+ return [SQLExpression(sql.format(expr=expr)) for expr in self(df)]
504
505
return self._with_window_function(fn)
506
0 commit comments