Fill even when no points exists in the given time range

Fix #996. Close #1067
pull/1068/merge
David Norton 2014-10-29 09:16:56 -04:00 committed by John Shahid
parent 899f2ba802
commit 309934dec5
3 changed files with 27 additions and 2 deletions

View File

@ -1,3 +1,10 @@
## v0.8.6 [unreleased]
### Bugfixes
- [Issue #996](https://github.com/influxdb/influxdb/issues/996). Fill should
fill the time range even if no points exists in the given time range
## v0.8.5 [2014-10-27]
### Features

View File

@ -88,7 +88,8 @@ func (self *AggregatorEngine) getTimestampBucket(timestampMicroseconds int64) in
}
func (self *AggregatorEngine) Yield(s *protocol.Series) (bool, error) {
if len(s.Points) == 0 {
if len(s.Points) == 0 && !self.isFillQuery {
log4go.Debug("AggregatorEngine: no points in series \"%s\"", *s.Name)
return true, nil
}

View File

@ -89,7 +89,7 @@ func (self *DataTestSuite) TestWritingToExpiredShards(c *C) {
data := CreatePoints("test_using_deleted_shard", 1, 1000000)
data[0].Columns = append(data[0].Columns, "time")
for i, _ := range data[0].Points {
for i := range data[0].Points {
data[0].Points[i] = append(data[0].Points[i], 0)
}
// This test will fail randomly without the fix submitted in the
@ -2754,3 +2754,20 @@ func (self *DataTestSuite) TestHistogramAggregateFillWith0(c *C) {
// Add some asserts here once engine/aggregator_operators.go
// func(self *HistogramAggregator) GetValues(...) is modified to sort data.
}
// Test issue #996: fill() does not fill empty series / timespan
func (self *DataTestSuite) TestIssue996FillEmptyTimespan(c *C) {
data := `
[
{
"name": "data",
"columns": ["time", "value"],
"points": [
[10000, 10.0]
]
}
]`
expect := []tv{{300000.0, nil}, {240000.0, nil}, {180000.0, nil}, {120000.0, nil}, {60000.0, nil}}
self.tstAggregateFill(data, "sum", "null", emptyAggArgs, expect, c)
}