Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 5ed6af1

Browse files
committed
apply to sqlglot compiler too
1 parent 2bea5ee commit 5ed6af1

4 files changed

Lines changed: 9 additions & 42 deletions

File tree

bigframes/core/compile/sqlglot/aggregations/unary_compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def _(
4444
column: typed_expr.TypedExpr,
4545
window: typing.Optional[window_spec.WindowSpec] = None,
4646
) -> sge.Expression:
47-
# if window is not None:
48-
# raise NotImplementedError("AllOp with windowing is not supported.")
47+
if window is not None:
48+
raise NotImplementedError("AllOp with windowing is not supported.")
4949

5050
# BQ will return null for empty column, result would be false in pandas.
5151
result = apply_window_if_present(sge.func("LOGICAL_AND", column.expr), window)

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_out.sql

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/unit/core/compile/sqlglot/aggregations/snapshots/test_unary_compiler/test_all/window_partition_out.sql

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/unit/core/compile/sqlglot/aggregations/test_unary_compiler.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,14 @@ def test_all(scalar_types_df: bpd.DataFrame, snapshot):
7272

7373
snapshot.assert_match(sql, "out.sql")
7474

75-
# Window tests
76-
window = window_spec.WindowSpec(ordering=(ordering.ascending_over(col_name),))
77-
sql_window = _apply_unary_window_op(bf_df, agg_expr, window, "agg_bool")
78-
snapshot.assert_match(sql_window, "window_out.sql")
7975

80-
bf_df_str = scalar_types_df[[col_name, "string_col"]]
81-
window_partition = window_spec.WindowSpec(
82-
grouping_keys=(expression.deref("string_col"),),
83-
ordering=(ordering.descending_over(col_name),),
84-
)
85-
sql_window_partition = _apply_unary_window_op(
86-
bf_df_str, agg_expr, window_partition, "agg_bool"
87-
)
88-
snapshot.assert_match(sql_window_partition, "window_partition_out.sql")
76+
def test_all_raises_error_with_window(scalar_types_df: bpd.DataFrame):
77+
col_name = "bool_col"
78+
bf_df = scalar_types_df[[col_name]]
79+
agg_expr = agg_ops.AllOp().as_expr(col_name)
80+
window = window_spec.WindowSpec(ordering=(ordering.ascending_over(col_name),))
81+
with pytest.raises(NotImplementedError):
82+
_apply_unary_window_op(bf_df, agg_expr, window, "agg_bool")
8983

9084

9185
def test_any(scalar_types_df: bpd.DataFrame, snapshot):

0 commit comments

Comments
 (0)