fix . Group by should respect null values

pull/488/merge
John Shahid 2014-05-07 19:06:25 -04:00
parent 0abd1c8ede
commit 15d7228cdc
3 changed files with 33 additions and 2 deletions

View File

@ -3,6 +3,7 @@
### Bugfixes
- [Issue #511](https://github.com/influxdb/influxdb/issues/511). Don't automatically create the database when a db user is created
- [Issue #512](https://github.com/influxdb/influxdb/issues/512). Group by should respect null values
- [Issue #369](https://github.com/influxdb/influxdb/issues/369). Fix some edge cases with WAL recovery
## v0.6.1 [2014-05-06]

View File

@ -96,6 +96,36 @@ func (self *DataTestSuite) TestAll(c *C) {
type Fun func(client Client)
// issue #512
func (self *DataTestSuite) GroupByNullValues(c *C) (Fun, Fun) {
// make sure we exceed the pointBatchSize, so we force a yield to
// the filtering engine
return func(client Client) {
data := `
[
{
"points": [
["one", null],
["one", 1],
["one", null]
],
"name": "test_null_groups",
"columns": ["column0", "column1"]
}
]`
client.WriteJsonData(data, c, influxdb.Second)
}, func(client Client) {
serieses := client.RunQuery("select count(column0) from test_null_groups group by column1", c, "m")
c.Assert(serieses, HasLen, 1)
maps := ToMap(serieses[0])
c.Assert(maps, HasLen, 2)
c.Assert(maps[0]["count"], Equals, 1.0)
// this is an implementation detail, but nulls come last in the
// trie
c.Assert(maps[1]["count"], Equals, 2.0)
}
}
// issue #389
func (self *DataTestSuite) FilteringShouldNotStopIfAllPointsDontMatch(c *C) (Fun, Fun) {
// make sure we exceed the pointBatchSize, so we force a yield to

View File

@ -179,7 +179,7 @@ func (self *FieldValue) Equals(other *FieldValue) bool {
}
return *other.StringValue == *self.StringValue
}
return false
return other.GetIsNull()
}
// defines total order on FieldValue, the following is true
@ -211,5 +211,5 @@ func (self *FieldValue) GreaterOrEqual(other *FieldValue) bool {
}
return *self.StringValue >= *other.StringValue
}
return other.BoolValue == nil && other.Int64Value == nil && other.DoubleValue == nil && other.StringValue == nil
return true
}