Fix AST influxql for parsing binary expressions in fields
parent
66429dddce
commit
ebe15248b0
|
@ -102,6 +102,8 @@ func Convert(influxQL string) (chronograf.QueryConfig, error) {
|
|||
fields := map[string][]string{}
|
||||
for _, fld := range stmt.Fields {
|
||||
switch f := fld.Expr.(type) {
|
||||
default:
|
||||
return raw, nil
|
||||
case *influxql.Call:
|
||||
// only support certain query config functions
|
||||
if _, ok := supportedFuncs[f.Name]; !ok {
|
||||
|
|
|
@ -27,6 +27,18 @@ func TestConvert(t *testing.T) {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Test math",
|
||||
influxQL: `SELECT count("event_id")/3 as "event_count_id" from discource.autogen.discourse_events where time > now() - 7d group by time(1d), "event_type"`,
|
||||
RawText: `SELECT count("event_id")/3 as "event_count_id" from discource.autogen.discourse_events where time > now() - 7d group by time(1d), "event_type"`,
|
||||
want: chronograf.QueryConfig{
|
||||
Fields: []chronograf.Field{},
|
||||
Tags: map[string][]string{},
|
||||
GroupBy: chronograf.GroupBy{
|
||||
Tags: []string{},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue