Skip to content

Commit

Permalink
fix(polars): remove bogus minus-one-week truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and jcrist committed Jul 23, 2024
1 parent e59a54c commit ac519b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
29 changes: 1 addition & 28 deletions ibis/backends/tests/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,35 +337,20 @@ 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(
"m",
"min",
marks=[
pytest.mark.notimpl(["sqlite"], raises=com.UnsupportedOperationError),
pytest.mark.broken(
["polars"],
raises=AssertionError,
reason="numpy array are different",
),
],
),
param(
"s",
"s",
marks=[
pytest.mark.notimpl(["sqlite"], raises=com.UnsupportedOperationError),
pytest.mark.broken(
["polars"],
raises=AssertionError,
reason="numpy array are different",
),
],
),
param(
Expand All @@ -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(
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ac519b2

Please sign in to comment.