Skip to content

Commit

Permalink
Merge pull request #2547 from neonstalwart/fix/2487
Browse files Browse the repository at this point in the history
handle aggregations with 0 intervals
  • Loading branch information
pauldix committed May 12, 2015
2 parents 6741675 + 8e02595 commit 2e57952
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd/influxd/server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
5 changes: 4 additions & 1 deletion influxql/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e57952

Please sign in to comment.