Skip to content

Commit ecaca9a

Browse files
committed
fix: Update DuckDBExpr.first
1/3 for #2528 (comment)
1 parent 68fdfe8 commit ecaca9a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

narwhals/_duckdb/expr.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,12 @@ def _clip_both(
495495

496496
@requires.backend_version((1, 3))
497497
def first(self) -> Self:
498-
def fn(inputs: DuckDBWindowInputs) -> Expression:
498+
def fn(df: DuckDBLazyFrame, inputs: DuckDBWindowInputs) -> Sequence[Expression]:
499499
order_by = generate_order_by_sql(*inputs.order_by, ascending=True)
500500
partition_by = generate_partition_by_sql(*inputs.partition_by)
501501
window = f"({partition_by} {order_by})"
502-
return SQLExpression(f"first({inputs.expr}) over {window}")
502+
sql = f"first({{expr}}) over {window}"
503+
return [SQLExpression(sql.format(expr=expr)) for expr in self(df)]
503504

504505
return self._with_window_function(fn)
505506

0 commit comments

Comments
 (0)