Skip to content

Commit 6239794

Browse files
gforsythcpcloud
authored andcommitted
fix(sqlite): truncate week to previous week not following
1 parent f6b2722 commit 6239794

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ibis/backends/sqlite/registry.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ def _extract_quarter(t, op):
9292

9393

9494
_truncate_modifiers = {
95-
DateUnit.DAY: "start of day",
96-
DateUnit.WEEK: "weekday 1",
97-
DateUnit.MONTH: "start of month",
98-
DateUnit.YEAR: "start of year",
99-
IntervalUnit.DAY: "start of day",
100-
IntervalUnit.WEEK: "weekday 1",
101-
IntervalUnit.MONTH: "start of month",
102-
IntervalUnit.YEAR: "start of year",
95+
DateUnit.DAY: ("start of day",),
96+
DateUnit.WEEK: ("weekday 0", "-6 days"),
97+
DateUnit.MONTH: ("start of month",),
98+
DateUnit.YEAR: ("start of year",),
99+
IntervalUnit.DAY: ("start of day",),
100+
IntervalUnit.WEEK: ("weekday 1",),
101+
IntervalUnit.MONTH: ("start of month",),
102+
IntervalUnit.YEAR: ("start of year",),
103103
}
104104

105105

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

117117
return translator
118118

ibis/backends/tests/test_temporal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def test_timestamp_truncate(backend, alltypes, df, unit):
537537
raises=com.UnsupportedOperationError,
538538
reason="Unsupported truncate unit W",
539539
),
540-
pytest.mark.broken(["impala", "sqlite"], raises=AssertionError),
540+
pytest.mark.broken(["impala"], raises=AssertionError),
541541
],
542542
),
543543
],

0 commit comments

Comments
 (0)