Skip to content

Commit a7359cf

Browse files
committed
app/vlselect/logsql: properly apply time offset inside alignStartEndToStep()
This is a follow-up for the commit ba1abd2 This is needed for #1066 (comment)
1 parent 27ccf7c commit a7359cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/vlselect/logsql/logsql.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,23 +1504,23 @@ func alignStartEndToStep(start, end, step, offset int64) (int64, int64) {
15041504
return start, end
15051505
}
15061506

1507-
start = logstorage.SubInt64NoOverflow(start, offset)
1507+
start = logstorage.SubInt64NoOverflow(start, -offset)
15081508
if start >= 0 {
15091509
start -= start % step
15101510
} else {
15111511
d := step + start%step
15121512
start = logstorage.SubInt64NoOverflow(start, d)
15131513
}
1514-
start = logstorage.SubInt64NoOverflow(start, -offset)
1514+
start = logstorage.SubInt64NoOverflow(start, offset)
15151515

1516-
end = logstorage.SubInt64NoOverflow(end, offset)
1516+
end = logstorage.SubInt64NoOverflow(end, -offset)
15171517
if end <= 0 {
15181518
end -= end % step
15191519
} else {
15201520
d := step - end%step
15211521
end = logstorage.SubInt64NoOverflow(end, -d)
15221522
}
1523-
end = logstorage.SubInt64NoOverflow(end, -offset)
1523+
end = logstorage.SubInt64NoOverflow(end, offset)
15241524

15251525
if end > math.MinInt64 {
15261526
end--

0 commit comments

Comments
 (0)