Skip to content

Commit

Permalink
Force UTC for truncates
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Dec 13, 2024
1 parent 51352e1 commit ab32d0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/queries/big_query/dimensional.sql.erb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ downloads_in_range AS (
if group.extract
selects << "EXTRACT(#{group.extract} FROM #{selector}) AS #{group.as}"
elsif group.truncate
selects << %Q(TIMESTAMP_TRUNC(#{selector}, #{group.truncate}, "UTC") AS #{group.as})
selects << %Q(FORMAT_TIMESTAMP("%Y-%m-%d %H:%M:%S %Ez", TIMESTAMP_TRUNC(#{selector}, #{group.truncate}, "UTC"), "UTC") AS #{group.as})
elsif group.indices
cases = []

Expand Down
2 changes: 1 addition & 1 deletion app/queries/big_query/time_series.sql.erb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ downloads_in_range AS (
if group.extract
selects << "EXTRACT(#{group.extract} FROM #{selector}) AS #{group.as}"
elsif group.truncate
selects << %Q(TIMESTAMP_TRUNC(#{selector}, #{group.truncate}, "UTC") AS #{group.as})
selects << %Q(FORMAT_TIMESTAMP("%Y-%m-%d %H:%M:%S %Ez", TIMESTAMP_TRUNC(#{selector}, #{group.truncate}, "UTC"), "UTC") AS #{group.as})
elsif group.indices
cases = []

Expand Down

0 comments on commit ab32d0b

Please sign in to comment.