diff --git a/ibis/backends/mssql/registry.py b/ibis/backends/mssql/registry.py index d0695eda9338..6d06bd2dcc58 100644 --- a/ibis/backends/mssql/registry.py +++ b/ibis/backends/mssql/registry.py @@ -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) diff --git a/ibis/backends/tests/test_aggregation.py b/ibis/backends/tests/test_aggregation.py index d93125dc0ca6..c06481e9398d 100644 --- a/ibis/backends/tests/test_aggregation.py +++ b/ibis/backends/tests/test_aggregation.py @@ -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( @@ -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() diff --git a/ibis/backends/tests/test_window.py b/ibis/backends/tests/test_window.py index e4285a3e273d..eb40e7d5292a 100644 --- a/ibis/backends/tests/test_window.py +++ b/ibis/backends/tests/test_window.py @@ -159,7 +159,6 @@ def calc_zscore(s): "duckdb", 'impala', 'postgres', - 'mssql', 'mysql', 'sqlite', 'snowflake', @@ -193,7 +192,6 @@ def calc_zscore(s): "duckdb", 'impala', 'postgres', - 'mssql', 'mysql', 'sqlite', 'snowflake',