diff --git a/src/query/plan/physical.go b/src/query/plan/physical.go index 325d4435b1..45d55c4224 100644 --- a/src/query/plan/physical.go +++ b/src/query/plan/physical.go @@ -97,8 +97,8 @@ func (p PhysicalPlan) shiftTime() PhysicalPlan { } spec := boundOp.Bounds() - if spec.Offset+p.LookbackDuration > maxOffset { - maxOffset = spec.Offset + p.LookbackDuration + if p.LookbackDuration > maxOffset { + maxOffset = p.LookbackDuration } if spec.Range > maxRange { diff --git a/src/query/plan/physical_test.go b/src/query/plan/physical_test.go index cfe5a72f6c..479fb577bc 100644 --- a/src/query/plan/physical_test.go +++ b/src/query/plan/physical_test.go @@ -98,6 +98,6 @@ func TestShiftTime(t *testing.T) { p, err = NewPhysicalPlan(lp, params) require.NoError(t, err) assert.Equal(t, params.Start. - Add(-1*(time.Minute+time.Hour+defaultLookbackDuration)), p.TimeSpec.Start, + Add(-1*(time.Hour+defaultLookbackDuration)), p.TimeSpec.Start, "start time offset by fetch") }