add a group by test for grouping by multiple columns.

pull/17/head
John Shahid 2013-10-10 13:06:03 -04:00
parent 0b7f080cd8
commit 1da5ce70a2
1 changed files with 129 additions and 0 deletions

View File

@ -323,8 +323,133 @@ func (self *EngineSuite) TestCountQueryWithGroupByClause(c *C) {
{
"int_value": 1
},
{
"string_value": "another_value"
}
],
"timestamp": 1381346631,
"sequence_number": 1
}
],
"name": "foo",
"fields": [
{
"type": "INT32",
"name": "count"
},
{
"type": "STRING",
"name": "column_one"
}
]
}
]
`)
}
func (self *EngineSuite) TestCountQueryWithGroupByClauseWithMultipleColumns(c *C) {
// make the mock coordinator return some data
engine := createEngine(c, `
[
{
"points": [
{
"values": [
{
"string_value": "some_value"
},
{
"int_value": 1
}
],
"timestamp": 1381346631,
"sequence_number": 1
},
{
"values": [
{
"string_value": "some_value"
},
{
"int_value": 2
}
],
"timestamp": 1381346631,
"sequence_number": 1
},
{
"values": [
{
"string_value": "another_value"
},
{
"int_value": 1
}
],
"timestamp": 1381346631,
"sequence_number": 1
}
],
"name": "foo",
"fields": [
{
"type": "STRING",
"name": "column_one"
},
{
"type": "INT32",
"name": "column_two"
}
]
}
]
`)
runQuery(engine, "select count(*), column_one, column_two from foo group by column_one, column_two;", c, `[
{
"points": [
{
"values": [
{
"int_value": 1
},
{
"string_value": "some_value"
},
{
"int_value": 1
}
],
"timestamp": 1381346631,
"sequence_number": 1
},
{
"values": [
{
"int_value": 1
},
{
"string_value": "some_value"
},
{
"int_value": 2
}
],
"timestamp": 1381346631,
"sequence_number": 1
},
{
"values": [
{
"int_value": 1
},
{
"string_value": "another_value"
},
{
"int_value": 1
}
],
"timestamp": 1381346631,
@ -352,6 +477,10 @@ func (self *EngineSuite) TestCountQueryWithGroupByClause(c *C) {
{
"type": "STRING",
"name": "column_one"
},
{
"type": "INT32",
"name": "column_two"
}
]
}