Skip to content

Commit 84a430e

Browse files
committed
refactor: add compile_window to the sqlglot compiler
1 parent 7e8658b commit 84a430e

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

bigframes/core/array_value.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -400,32 +400,6 @@ def aggregate(
400400
)
401401
)
402402

403-
def project_window_op(
404-
self,
405-
column_name: str,
406-
op: agg_ops.UnaryWindowOp,
407-
window_spec: WindowSpec,
408-
*,
409-
never_skip_nulls=False,
410-
skip_reproject_unsafe: bool = False,
411-
) -> Tuple[ArrayValue, str]:
412-
"""
413-
Creates a new expression based on this expression with unary operation applied to one column.
414-
column_name: the id of the input column present in the expression
415-
op: the windowable operator to apply to the input column
416-
window_spec: a specification of the window over which to apply the operator
417-
output_name: the id to assign to the output of the operator, by default will replace input col if distinct output id not provided
418-
never_skip_nulls: will disable null skipping for operators that would otherwise do so
419-
skip_reproject_unsafe: skips the reprojection step, can be used when performing many non-dependent window operations, user responsible for not nesting window expressions, or using outputs as join, filter or aggregation keys before a reprojection
420-
"""
421-
422-
return self.project_window_expr(
423-
ex.UnaryAggregation(op, ex.deref(column_name)),
424-
window_spec,
425-
never_skip_nulls,
426-
skip_reproject_unsafe,
427-
)
428-
429403
def project_window_expr(
430404
self,
431405
expression: ex.Aggregation,

bigframes/core/compile/compiled.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def project_window_op(
460460
for column in inputs:
461461
clauses.append((column.isnull(), ibis_types.null()))
462462
if window_spec.min_periods and len(inputs) > 0:
463-
if expression.op.skips_nulls:
463+
if expression.op.skips_nulls and not never_skip_nulls:
464464
# Most operations do not count NULL values towards min_periods
465465
per_col_does_count = (column.notnull() for column in inputs)
466466
# All inputs must be non-null for observation to count

0 commit comments

Comments
 (0)