// Count the number of points. func (n *chainnode) Count(field string) *InfluxQLNode { i := newInfluxQLNode("count", field, n.Provides(), StreamEdge, ReduceCreater{ CreateFloatIntegerReducer: func() (influxql.FloatPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewFloatFuncIntegerReducer(influxql.FloatCountReduce) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerCountReduce) return fn, fn }, }) n.linkChild(i) return i }
// 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, nil) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerMaxReduce, 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 }
// Count the number of points. func (n *chainnode) Count(field string) *InfluxQLNode { i := newInfluxQLNode("count", field, n.Provides(), StreamEdge, ReduceCreater{ CreateFloatIntegerReducer: func() (influxql.FloatPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewFloatFuncIntegerReducer(influxql.FloatCountReduce, &influxql.IntegerPoint{Value: 0}) return fn, fn }, CreateIntegerReducer: func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewIntegerFuncReducer(influxql.IntegerCountReduce, &influxql.IntegerPoint{Value: 0}) return fn, fn }, CreateStringIntegerReducer: func() (influxql.StringPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewStringFuncIntegerReducer(influxql.StringCountReduce, &influxql.IntegerPoint{Value: 0}) return fn, fn }, CreateBooleanIntegerReducer: func() (influxql.BooleanPointAggregator, influxql.IntegerPointEmitter) { fn := influxql.NewBooleanFuncIntegerReducer(influxql.BooleanCountReduce, &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 }