Skip to content

Commit

Permalink
fix(mssql): improve aggregation on expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Mar 16, 2023
1 parent 1ce3ef9 commit 58aa78d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
7 changes: 5 additions & 2 deletions ibis/backends/mssql/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ def reduction_compiler(t, op):
arg, where = op.args

if arg.output_dtype.is_boolean():
nullable = arg.output_dtype.nullable
arg = ops.Cast(arg, dt.dtype(cast_type)(nullable=nullable))
if isinstance(arg, ops.TableColumn):
nullable = arg.output_dtype.nullable
arg = ops.Cast(arg, dt.dtype(cast_type)(nullable=nullable))
else:
arg = ops.Where(arg, 1, 0)

if where is not None:
arg = ops.Where(where, arg, None)
Expand Down
10 changes: 0 additions & 10 deletions ibis/backends/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,6 @@ def mean_and_std(v):
"function sum requires numeric or interval types, not boolean;"
),
),
pytest.mark.notimpl(
['mssql'],
raises=sa.exc.OperationalError,
reason="Incorrect syntax near the keyword 'AS'",
),
],
),
param(
Expand Down Expand Up @@ -1429,11 +1424,6 @@ def test_filter(backend, alltypes, df):
"function sum requires numeric or interval types, not boolean;"
),
)
@pytest.mark.notimpl(
["mssql"],
raises=sa.exc.OperationalError,
reason="Incorrect syntax near the keyword 'AS'",
)
def test_column_summary(alltypes):
with pytest.warns(FutureWarning, match="is deprecated"):
bool_col_summary = alltypes.bool_col.summary()
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ def calc_zscore(s):
"duckdb",
'impala',
'postgres',
'mssql',
'mysql',
'sqlite',
'snowflake',
Expand Down Expand Up @@ -193,7 +192,6 @@ def calc_zscore(s):
"duckdb",
'impala',
'postgres',
'mssql',
'mysql',
'sqlite',
'snowflake',
Expand Down

0 comments on commit 58aa78d

Please sign in to comment.