Merge pull request #2547 from neonstalwart/fix/2487
handle aggregations with 0 intervalspull/2549/head
commit
2e57952903
|
@ -673,6 +673,12 @@ func runTestsData(t *testing.T, testName string, nodes Cluster, database, retent
|
|||
queryDb: "%DB%",
|
||||
expected: `{"results":[{"series":[{"name":"cpu","columns":["time","value"],"values":[["2000-01-01T00:00:10Z",30]]}]}]}`,
|
||||
},
|
||||
{
|
||||
name: "aggregation with no interval",
|
||||
query: `SELECT count(value) FROM cpu WHERE time = '2000-01-01 00:00:00'`,
|
||||
queryDb: "%DB%",
|
||||
expected: `{"results":[{"series":[{"name":"cpu","columns":["time","count"],"values":[["2000-01-01T00:00:00Z",2]]}]}]}`,
|
||||
},
|
||||
{
|
||||
name: "sum aggregation",
|
||||
query: `SELECT SUM(value) FROM cpu WHERE time >= '2000-01-01 00:00:05' AND time <= '2000-01-01T00:00:10Z' GROUP BY time(10s), region`,
|
||||
|
|
|
@ -135,7 +135,10 @@ func (m *MapReduceJob) Execute(out chan *Row, filterEmptyResults bool) {
|
|||
resultValues := make([][]interface{}, pointCountInResult)
|
||||
|
||||
// ensure that the start time for the results is on the start of the window
|
||||
startTimeBucket := m.TMin / m.interval * m.interval
|
||||
startTimeBucket := m.TMin
|
||||
if m.interval > 0 {
|
||||
startTimeBucket = startTimeBucket / m.interval * m.interval
|
||||
}
|
||||
|
||||
for i, _ := range resultValues {
|
||||
var t int64
|
||||
|
|
Loading…
Reference in New Issue