Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bigframes/core/compile/ibis_compiler/aggregate_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ def _(
column: ibis_types.Column,
window=None,
) -> ibis_types.BooleanValue:
if window is not None:
raise NotImplementedError("AllOp with windowing is not supported.")

# BQ will return null for empty column, result would be false in pandas.
result = _apply_window_if_present(_is_true(column).all(), window)
literal = ibis_types.literal(True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def _(
column: typed_expr.TypedExpr,
window: typing.Optional[window_spec.WindowSpec] = None,
) -> sge.Expression:
if window is not None:
raise NotImplementedError("AllOp with windowing is not supported.")

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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,14 @@ def test_all(scalar_types_df: bpd.DataFrame, snapshot):

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

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

bf_df_str = scalar_types_df[[col_name, "string_col"]]
window_partition = window_spec.WindowSpec(
grouping_keys=(expression.deref("string_col"),),
ordering=(ordering.descending_over(col_name),),
)
sql_window_partition = _apply_unary_window_op(
bf_df_str, agg_expr, window_partition, "agg_bool"
)
snapshot.assert_match(sql_window_partition, "window_partition_out.sql")
def test_all_raises_error_with_window(scalar_types_df: bpd.DataFrame):
col_name = "bool_col"
bf_df = scalar_types_df[[col_name]]
agg_expr = agg_ops.AllOp().as_expr(col_name)
window = window_spec.WindowSpec(ordering=(ordering.ascending_over(col_name),))
with pytest.raises(NotImplementedError):
_apply_unary_window_op(bf_df, agg_expr, window, "agg_bool")


def test_any(scalar_types_df: bpd.DataFrame, snapshot):
Expand Down