Skip to content

Commit 8798476

Browse files
committed
better timeGroup macro handling for sub-second intervals
1 parent 5d94894 commit 8798476

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/bigquery/macros.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func macroTimeGroup(query *sqlds.Query, args []string) (string, error) {
4646

4747
}
4848

49-
return fmt.Sprintf("TIMESTAMP_SECONDS(DIV(UNIX_SECONDS(%s), %v) * %v)", timeVar, interval.Seconds(), interval.Seconds()), nil
49+
return fmt.Sprintf("TIMESTAMP_MILLIS(DIV(UNIX_MILLIS(%s), %v) * %v)", timeVar, interval.Milliseconds(), interval.Milliseconds()), nil
5050
}
5151

5252
var macros = map[string]sqlds.MacroFunc{

0 commit comments

Comments
 (0)