fix(issue #31927): TimeGrain.WEEK_STARTING_MONDAY (#32015)

This commit is contained in:
Adrian Mastronardi 2025-01-28 19:40:05 -05:00 committed by GitHub
parent f4efce3475
commit a21f184058
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 6 deletions

View File

@ -88,12 +88,10 @@ class SqliteEngineSpec(BaseEngineSpec):
TimeGrain.YEAR: "DATETIME({col}, 'start of year')",
TimeGrain.WEEK_ENDING_SATURDAY: "DATETIME({col}, 'start of day', 'weekday 6')",
TimeGrain.WEEK_ENDING_SUNDAY: "DATETIME({col}, 'start of day', 'weekday 0')",
TimeGrain.WEEK_STARTING_SUNDAY: (
"DATETIME({col}, 'start of day', 'weekday 0', '-7 days')"
),
TimeGrain.WEEK_STARTING_MONDAY: (
"DATETIME({col}, 'start of day', 'weekday 1', '-7 days')"
),
TimeGrain.WEEK_STARTING_SUNDAY: "DATETIME({col}, 'start of day', \
-strftime('%w', {col}) || ' days')",
TimeGrain.WEEK_STARTING_MONDAY: "DATETIME({col}, 'start of day', '-' || \
((strftime('%w', {col}) + 6) % 7) || ' days')",
}
# not sure why these are different
_time_grain_expressions.update(