From ac519b273cd6c7f151c9abee350698e49c7be3b0 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Tue, 23 Jul 2024 07:56:00 -0400 Subject: [PATCH] fix(polars): remove bogus minus-one-week truncation --- ibis/backends/polars/compiler.py | 2 +- ibis/backends/tests/test_temporal.py | 29 +--------------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/ibis/backends/polars/compiler.py b/ibis/backends/polars/compiler.py index 8db67bc652cc..3593ec9d4ff1 100644 --- a/ibis/backends/polars/compiler.py +++ b/ibis/backends/polars/compiler.py @@ -865,7 +865,7 @@ def temporal_truncate(op, **kw): arg = translate(op.arg, **kw) unit = "mo" if op.unit.short == "M" else op.unit.short unit = f"1{unit.lower()}" - return arg.dt.truncate(unit).dt.offset_by("-1w") + return arg.dt.truncate(unit) def _compile_literal_interval(op): diff --git a/ibis/backends/tests/test_temporal.py b/ibis/backends/tests/test_temporal.py index a1e5667dc7e6..8fe67904040e 100644 --- a/ibis/backends/tests/test_temporal.py +++ b/ibis/backends/tests/test_temporal.py @@ -337,11 +337,6 @@ def test_timestamp_extract_week_of_year(backend, alltypes, df): "h", marks=[ pytest.mark.notimpl(["sqlite"], raises=com.UnsupportedOperationError), - pytest.mark.broken( - ["polars"], - raises=AssertionError, - reason="numpy array are different", - ), ], ), param( @@ -349,11 +344,6 @@ def test_timestamp_extract_week_of_year(backend, alltypes, df): "min", marks=[ pytest.mark.notimpl(["sqlite"], raises=com.UnsupportedOperationError), - pytest.mark.broken( - ["polars"], - raises=AssertionError, - reason="numpy array are different", - ), ], ), param( @@ -361,11 +351,6 @@ def test_timestamp_extract_week_of_year(backend, alltypes, df): "s", marks=[ pytest.mark.notimpl(["sqlite"], raises=com.UnsupportedOperationError), - pytest.mark.broken( - ["polars"], - raises=AssertionError, - reason="numpy array are different", - ), ], ), param( @@ -376,11 +361,6 @@ def test_timestamp_extract_week_of_year(backend, alltypes, df): ["clickhouse", "mysql", "sqlite", "datafusion", "exasol"], raises=com.UnsupportedOperationError, ), - pytest.mark.broken( - ["polars"], - raises=AssertionError, - reason="numpy array are different", - ), ], ), param( @@ -391,11 +371,6 @@ def test_timestamp_extract_week_of_year(backend, alltypes, df): ["clickhouse", "mysql", "sqlite", "trino", "datafusion", "exasol"], raises=com.UnsupportedOperationError, ), - pytest.mark.broken( - ["polars"], - raises=AssertionError, - reason="numpy array are different", - ), pytest.mark.notyet( ["flink"], raises=Py4JJavaError, @@ -481,9 +456,7 @@ def test_timestamp_truncate(backend, alltypes, df, ibis_unit, pandas_unit): ), ], ) -@pytest.mark.broken( - ["polars", "druid"], reason="snaps to the UNIX epoch", raises=AssertionError -) +@pytest.mark.broken(["druid"], reason="snaps to the UNIX epoch", raises=AssertionError) @pytest.mark.broken( ["druid"], raises=AttributeError,