parent
36ca49c17b
commit
66a599825b
|
@ -5,6 +5,7 @@
|
|||
- [#6237](https://github.com/influxdata/influxdb/issues/6237): Enable continuous integration testing on Windows platform via AppVeyor. Thanks @mvadu
|
||||
- [#6263](https://github.com/influxdata/influxdb/pull/6263): Reduce UDP Service allocation size.
|
||||
- [#6228](https://github.com/influxdata/influxdb/pull/6228): Support for multiple listeners for collectd and OpenTSDB inputs.
|
||||
- [#6292](https://github.com/influxdata/influxdb/issues/6292): Allow percentile to be used as a selector.
|
||||
|
||||
### Bugfixes
|
||||
|
||||
|
|
|
@ -3564,13 +3564,13 @@ func TestServer_Query_AggregateSelectors(t *testing.T) {
|
|||
name: "percentile - time",
|
||||
params: url.Values{"db": []string{"db0"}},
|
||||
command: `SELECT time, percentile(rx, 75) FROM network where time >= '2000-01-01T00:00:00Z' AND time <= '2000-01-01T00:01:29Z' group by time(30s)`,
|
||||
exp: `{"error":"error parsing query: mixing aggregate and non-aggregate queries is not supported"}`,
|
||||
exp: `{"results":[{"series":[{"name":"network","columns":["time","percentile"],"values":[["2000-01-01T00:00:00Z",40],["2000-01-01T00:00:30Z",50],["2000-01-01T00:01:00Z",70]]}]}]}`,
|
||||
},
|
||||
&Query{
|
||||
name: "percentile - tx",
|
||||
params: url.Values{"db": []string{"db0"}},
|
||||
command: `SELECT tx, percentile(rx, 75) FROM network where time >= '2000-01-01T00:00:00Z' AND time <= '2000-01-01T00:01:29Z' group by time(30s)`,
|
||||
exp: `{"error":"error parsing query: mixing aggregate and non-aggregate queries is not supported"}`,
|
||||
exp: `{"results":[{"series":[{"name":"network","columns":["time","tx","percentile"],"values":[["2000-01-01T00:00:00Z",50,40],["2000-01-01T00:00:30Z",70,50],["2000-01-01T00:01:00Z",30,70]]}]}]}`,
|
||||
},
|
||||
}...)
|
||||
|
||||
|
|
|
@ -1403,12 +1403,12 @@ func (s *SelectStatement) validSelectWithAggregate() error {
|
|||
numAggregates++
|
||||
}
|
||||
}
|
||||
// For TOP, BOTTOM, MAX, MIN, FIRST, LAST (selector functions) it is ok to ask for fields and tags
|
||||
// For TOP, BOTTOM, MAX, MIN, FIRST, LAST, PERCENTILE (selector functions) it is ok to ask for fields and tags
|
||||
// but only if one function is specified. Combining multiple functions and fields and tags is not currently supported
|
||||
onlySelectors := true
|
||||
for k := range calls {
|
||||
switch k {
|
||||
case "top", "bottom", "max", "min", "first", "last":
|
||||
case "top", "bottom", "max", "min", "first", "last", "percentile":
|
||||
default:
|
||||
onlySelectors = false
|
||||
break
|
||||
|
|
|
@ -920,7 +920,7 @@ func NewFloatPercentileReduceSliceFunc(percentile float64) FloatReduceSliceFunc
|
|||
}
|
||||
|
||||
sort.Sort(floatPointsByValue(a))
|
||||
return []FloatPoint{{Time: ZeroTime, Value: a[i].Value, Aux: a[i].Aux}}
|
||||
return []FloatPoint{{Time: a[i].Time, Value: a[i].Value, Aux: a[i].Aux}}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -382,6 +382,18 @@ func TestParser_ParseStatement(t *testing.T) {
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
s: `select percentile("field1", 2.0), field2 from cpu`,
|
||||
stmt: &influxql.SelectStatement{
|
||||
IsRawQuery: false,
|
||||
Fields: []*influxql.Field{
|
||||
{Expr: &influxql.Call{Name: "percentile", Args: []influxql.Expr{&influxql.VarRef{Val: "field1"}, &influxql.NumberLiteral{Val: 2.0}}}},
|
||||
{Expr: &influxql.VarRef{Val: "field2"}},
|
||||
},
|
||||
Sources: []influxql.Source{&influxql.Measurement{Name: "cpu"}},
|
||||
},
|
||||
},
|
||||
|
||||
// select top statements
|
||||
{
|
||||
s: `select top("field1", 2) from cpu`,
|
||||
|
|
Loading…
Reference in New Issue