// Select the maximum point. func (n *chainnode) Max(field string) *InfluxQLNode { i := newInfluxQLNode("max", field, n.Provides(), StreamEdge, ReduceCreater{ CreateFloatReducer: func() (influxql.FloatPointAggregator, influxql.FloatPointEmitter) { fn := influxql.NewFloatFuncReducer(influxql.FloatMaxReduce) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerMaxReduce) return fn, fn }, }) n.linkChild(i) return i }
// Select the minimum point. func (n *chainnode) Min(field string) *InfluxQLNode { i := newInfluxQLNode("min", field, n.Provides(), StreamEdge, ReduceCreater{ CreateFloatReducer: func() (influxql.FloatPointAggregator, influxql.FloatPointEmitter) { fn := influxql.NewFloatFuncReducer(influxql.FloatMinReduce, nil) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerMinReduce, nil) return fn, fn }, IsSimpleSelector: true, }) n.linkChild(i) return i }
// Compute the sum of all values. func (n *chainnode) Sum(field string) *InfluxQLNode { i := newInfluxQLNode("sum", field, n.Provides(), StreamEdge, ReduceCreater{ CreateFloatReducer: func() (influxql.FloatPointAggregator, influxql.FloatPointEmitter) { fn := influxql.NewFloatFuncReducer(influxql.FloatSumReduce, &influxql.FloatPoint{Value: 0}) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerSumReduce, &influxql.IntegerPoint{Value: 0}) return fn, fn }, IsEmptyOK: true, }) n.linkChild(i) return i }
// Select the last point. func (n *chainnode) Last(field string) *InfluxQLNode { i := newInfluxQLNode("last", field, n.Provides(), StreamEdge, ReduceCreater{ CreateFloatReducer: func() (influxql.FloatPointAggregator, influxql.FloatPointEmitter) { fn := influxql.NewFloatFuncReducer(influxql.FloatLastReduce, nil) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerLastReduce, nil) return fn, fn }, CreateStringReducer: func() (influxql.StringPointAggregator, influxql.StringPointEmitter) { fn := influxql.NewStringFuncReducer(influxql.StringLastReduce, nil) return fn, fn }, CreateBooleanReducer: func() (influxql.BooleanPointAggregator, influxql.BooleanPointEmitter) { fn := influxql.NewBooleanFuncReducer(influxql.BooleanLastReduce, nil) return fn, fn }, IsSimpleSelector: true, }) n.linkChild(i) return i }