SQL: Fix SQL dataframe resampling (fill mode + time intervals) (#36937) (#37330)

* Refactor resample logic

* Adjust test to have one more timestamp out of range

* adjust test + ensure filling

* revert flag flip

* Undo logic - should be timeseries only

* change data calculation based on previous interval

* fix the logics

* fix typo

* fix resample start time, to reuse what sql api returned

* calculate the start point with from truncate by interval

Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Ying WANG <ying.wang@grafana.com>
(cherry picked from commit 180b1973e0)

Co-authored-by: idafurjes <36131195+idafurjes@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)
2021-07-29 08:05:59 +01:00
committed by GitHub
parent 33ab22229f
commit 0f5446d768
6 changed files with 67 additions and 236 deletions
-4
View File
@@ -335,10 +335,6 @@ func (e *dataPlugin) executeQuery(query plugins.DataSubQuery, wg *sync.WaitGroup
e.log.Error("Failed to resample dataframe", "err", err)
frame.AppendNotices(data.Notice{Text: "Failed to resample dataframe", Severity: data.NoticeSeverityWarning})
}
if err := trim(frame, *qm); err != nil {
e.log.Error("Failed to trim dataframe", "err", err)
frame.AppendNotices(data.Notice{Text: "Failed to trim dataframe", Severity: data.NoticeSeverityWarning})
}
}
}