Skip to content

Commit

Permalink
feat(snowflake): support binary variance reduction with filters
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Mar 15, 2023
1 parent 2219866 commit eeabdee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 10 additions & 5 deletions ibis/backends/postgres/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,17 @@ def variance_compiler(t, op):
if (y_type := y.output_dtype).is_boolean():
y = ops.Cast(y, dt.Int32(nullable=y_type.nullable))

result = func(t.translate(x), t.translate(y))
if t._has_reduction_filter_syntax:
result = func(t.translate(x), t.translate(y))

if (where := op.where) is not None:
return result.filter(t.translate(where))

return result
if (where := op.where) is not None:
return result.filter(t.translate(where))
return result
else:
if (where := op.where) is not None:
x = ops.Where(where, x, None)
y = ops.Where(where, y, None)
return func(t.translate(x), t.translate(y))

return variance_compiler

Expand Down
6 changes: 0 additions & 6 deletions ibis/backends/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,12 +722,6 @@ def test_quantile(
lambda t: t.yearID.isin([2009, 2015]),
lambda t: t.yearID.isin([2009, 2015]),
id='cond',
marks=[
pytest.mark.broken(
["snowflake"],
reason=("snowflake doesn't allow quoted columns in group_by"),
),
],
),
],
)
Expand Down

0 comments on commit eeabdee

Please sign in to comment.