Skip to content

Commit

Permalink
fix(sqlite): truncate week to previous week not following
Browse files Browse the repository at this point in the history
  • Loading branch information
gforsyth authored and cpcloud committed Oct 31, 2023
1 parent f6b2722 commit 6239794
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions ibis/backends/sqlite/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ def _extract_quarter(t, op):


_truncate_modifiers = {
DateUnit.DAY: "start of day",
DateUnit.WEEK: "weekday 1",
DateUnit.MONTH: "start of month",
DateUnit.YEAR: "start of year",
IntervalUnit.DAY: "start of day",
IntervalUnit.WEEK: "weekday 1",
IntervalUnit.MONTH: "start of month",
IntervalUnit.YEAR: "start of year",
DateUnit.DAY: ("start of day",),
DateUnit.WEEK: ("weekday 0", "-6 days"),
DateUnit.MONTH: ("start of month",),
DateUnit.YEAR: ("start of year",),
IntervalUnit.DAY: ("start of day",),
IntervalUnit.WEEK: ("weekday 1",),
IntervalUnit.MONTH: ("start of month",),
IntervalUnit.YEAR: ("start of year",),
}


Expand All @@ -112,7 +112,7 @@ def translator(t, op):
raise com.UnsupportedOperationError(
f"Unsupported truncate unit {op.unit!r}"
)
return func(sa_arg, modifier)
return func(sa_arg, *modifier)

return translator

Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/tests/test_temporal.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def test_timestamp_truncate(backend, alltypes, df, unit):
raises=com.UnsupportedOperationError,
reason="Unsupported truncate unit W",
),
pytest.mark.broken(["impala", "sqlite"], raises=AssertionError),
pytest.mark.broken(["impala"], raises=AssertionError),
],
),
],
Expand Down

0 comments on commit 6239794

Please sign in to comment.