Skip to content

Commit

Permalink
fix #512. Group by should respect null values
Browse files Browse the repository at this point in the history
  • Loading branch information
jvshahid authored and pauldix committed May 27, 2014
1 parent b18eab6 commit 42a8c7c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
30 changes: 30 additions & 0 deletions src/integration/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/protocol/protocol_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit 42a8c7c

Please sign in to comment.