diff --git a/ibis/backends/sql/compilers/mssql.py b/ibis/backends/sql/compilers/mssql.py index 5316a43c2866..a67b8321c1f8 100644 --- a/ibis/backends/sql/compilers/mssql.py +++ b/ibis/backends/sql/compilers/mssql.py @@ -89,7 +89,6 @@ class MSSQLCompiler(SQLGlotCompiler): ops.Covariance, ops.CountDistinctStar, ops.DateDiff, - ops.EndsWith, ops.IntervalAdd, ops.IntervalSubtract, ops.IntervalMultiply, @@ -108,7 +107,6 @@ class MSSQLCompiler(SQLGlotCompiler): ops.RegexSplit, ops.RowID, ops.RPad, - ops.StartsWith, ops.StringSplit, ops.StringToDate, ops.StringToTimestamp, @@ -522,5 +520,11 @@ def visit_TimestampSub(self, op, *, left, right): visit_DateAdd = visit_TimestampAdd visit_DateSub = visit_TimestampSub + def visit_StartsWith(self, op, *, arg, start): + return arg.like(self.f.concat(start, "%")) + + def visit_EndsWith(self, op, *, arg, end): + return arg.like(self.f.concat("%", end)) + compiler = MSSQLCompiler() diff --git a/ibis/backends/tests/test_string.py b/ibis/backends/tests/test_string.py index 519d933e5093..2ab995d3931e 100644 --- a/ibis/backends/tests/test_string.py +++ b/ibis/backends/tests/test_string.py @@ -515,9 +515,6 @@ def uses_java_re(t): ), lambda t: t.int_col == 1, id="startswith", - marks=[ - pytest.mark.notimpl(["mssql"], raises=com.OperationNotDefinedError), - ], ), param( lambda t: t.int_col.cases([(1, "abcd"), (2, "ABCD")], "dabc").endswith( @@ -525,25 +522,16 @@ def uses_java_re(t): ), lambda t: t.int_col == 1, id="endswith", - marks=[ - pytest.mark.notimpl(["mssql"], raises=com.OperationNotDefinedError), - ], ), param( lambda t: t.date_string_col.startswith("2010-01"), lambda t: t.date_string_col.str.startswith("2010-01"), id="startswith-simple", - marks=[ - pytest.mark.notimpl(["mssql"], raises=com.OperationNotDefinedError), - ], ), param( lambda t: t.date_string_col.endswith("/10"), lambda t: t.date_string_col.str.endswith("/10"), id="endswith-simple", - marks=[ - pytest.mark.notimpl(["mssql"], raises=com.OperationNotDefinedError), - ], ), param( lambda t: t.string_col.strip(),