Add test of InfluxQL parsing with aggregates and aliases

pull/10616/head
Chris Goller 2017-10-17 13:50:52 -05:00
parent 312e74993f
commit 2c3c9f39cc
1 changed files with 25 additions and 0 deletions

View File

@ -629,6 +629,31 @@ func TestConvert(t *testing.T) {
AreTagsAccepted: false,
},
},
{
name: "count with aggregate",
influxQL: `SELECT COUNT(water) as "count_water" FROM "h2o_feet"`,
want: chronograf.QueryConfig{
Measurement: "h2o_feet",
Fields: []chronograf.Field{
chronograf.Field{
Value: "count",
Type: "func",
Alias: "count_water",
Args: []chronograf.Field{
{
Value: "water",
Type: "field",
},
},
},
},
GroupBy: chronograf.GroupBy{
Tags: []string{},
},
Tags: map[string][]string{},
AreTagsAccepted: false,
},
},
{
name: "count of a wildcard",
influxQL: ` SELECT COUNT(*) FROM "h2o_feet"`,