Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT
*
FROM `t` AS `t0`
QUALIFY
LOGICAL_OR(`t0`.`a` = 'hello') OVER (PARTITION BY `t0`.`x` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
7 changes: 7 additions & 0 deletions ibis/backends/bigquery/tests/unit/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,3 +711,10 @@ def test_unreasonably_long_name():
match="BigQuery does not allow column names longer than 300 characters",
):
ibis.to_sql(expr, dialect="bigquery")


def test_window_filter(snapshot):
t = ibis.table([("a", "string"), ("x", "int64")], name="t")
expr = t.filter((_.a == "hello").any().over(group_by=_.x))
result = to_sql(expr)
snapshot.assert_match(result, "out.sql")
6 changes: 1 addition & 5 deletions ibis/backends/sql/rewrites.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,7 @@ def exclude_unsupported_window_frame_from_rank(_, **kwargs):
)


@replace(
p.WindowFunction(
p.Lag | p.Lead | p.PercentRank | p.CumeDist | p.Any | p.All, start=None
)
)
@replace(p.WindowFunction(p.Lag | p.Lead | p.PercentRank | p.CumeDist, start=None))
def exclude_unsupported_window_frame_from_ops(_, **kwargs):
return _.copy(start=None, end=0, order_by=_.order_by or (ops.NULL,))

Expand Down