diff --git a/CHANGELOG.md b/CHANGELOG.md index 96c237cf56..8417f52c84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Bug Fixes 1. [#1364](https://github.com/influxdata/chronograf/pull/1364): Fix link to home when using the --basepath option 1. [#1370](https://github.com/influxdata/chronograf/pull/1370): Remove notification to login outside of session timeout + 1. [#1376](https://github.com/influxdata/chronograf/pull/1376): Fix queries built in query builder with math functions in fields ### Features ### UI Improvements diff --git a/influx/query.go b/influx/query.go index af35779404..dc88932ef0 100644 --- a/influx/query.go +++ b/influx/query.go @@ -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 { diff --git a/influx/query_test.go b/influx/query_test.go index 50c95354a5..9be203c480 100644 --- a/influx/query_test.go +++ b/influx/query_test.go @@ -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) {