2017-08-15 19:24:22 +00:00
package query_test
2015-11-04 21:06:06 +00:00
import (
2017-10-11 14:08:31 +00:00
"context"
2016-06-03 03:03:57 +00:00
"fmt"
Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.
This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.
These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.
It will then sort the final result to ensure the correct ordering of the
selected points.
When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:
SELECT top(value, host, 2) FROM cpu
Essentially becomes this query:
SELECT top(value, 2), host FROM (
SELECT max(value) FROM cpu GROUP BY host
)
This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-16 17:37:39 +00:00
"math/rand"
2015-11-04 21:06:06 +00:00
"reflect"
"testing"
"time"
"github.com/davecgh/go-spew/spew"
2017-07-21 18:07:46 +00:00
"github.com/google/go-cmp/cmp"
2017-08-15 19:24:22 +00:00
"github.com/influxdata/influxdb/query"
2017-10-30 21:40:26 +00:00
"github.com/influxdata/influxql"
2015-11-04 21:06:06 +00:00
)
// Second represents a helper for type converting durations.
const Second = int64 ( time . Second )
2017-08-23 02:01:31 +00:00
func TestSelect ( t * testing . T ) {
for _ , tt := range [ ] struct {
2018-03-01 20:12:22 +00:00
name string
q string
typ influxql . DataType
expr string
itrs [ ] query . Iterator
rows [ ] query . Row
err string
2017-08-23 02:01:31 +00:00
} {
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Min" ,
q : ` SELECT min(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` min(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Distinct_Float" ,
q : ` SELECT distinct(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : 19 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Distinct_Integer" ,
q : ` SELECT distinct(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : 19 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 19 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Distinct_Unsigned" ,
q : ` SELECT distinct(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : 19 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 19 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Distinct_String" ,
q : ` SELECT distinct(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . String ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : "a" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : "b" } ,
} } ,
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : "c" } ,
} } ,
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : "b" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : "d" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : "d" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : "d" } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "a" } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "b" } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "d" } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { "c" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Distinct_Boolean" ,
q : ` SELECT distinct(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Boolean ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : true } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : false } ,
} } ,
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : false } ,
} } ,
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : true } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : false } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : false } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : true } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { true } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { false } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { false } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { true } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { false } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Mean_Float" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 19.5 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 2.5 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { 3.2 } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Mean_Integer" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
expr : ` mean(value::integer) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 19.5 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 2.5 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { 3.2 } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Mean_Unsigned" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
expr : ` mean(value::Unsigned) ` ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 19.5 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 2.5 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { 3.2 } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Mean_String" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . String ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator { & StringIterator { } } ,
err : ` unsupported mean iterator type: *query_test.StringIterator ` ,
} ,
{
name : "Mean_Boolean" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Boolean ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator { & BooleanIterator { } } ,
err : ` unsupported mean iterator type: *query_test.BooleanIterator ` ,
} ,
{
name : "Median_Float" ,
q : ` SELECT median(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 19.5 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 2.5 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Median_Integer" ,
q : ` SELECT median(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 19.5 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 2.5 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Median_Unsigned" ,
q : ` SELECT median(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 19.5 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 2.5 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Median_String" ,
q : ` SELECT median(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . String ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator { & StringIterator { } } ,
err : ` unsupported median iterator type: *query_test.StringIterator ` ,
} ,
{
name : "Median_Boolean" ,
q : ` SELECT median(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Boolean ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator { & BooleanIterator { } } ,
err : ` unsupported median iterator type: *query_test.BooleanIterator ` ,
} ,
{
name : "Mode_Float" ,
q : ` SELECT mode(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Mode_Integer" ,
q : ` SELECT mode(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 54 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Mode_Unsigned" ,
q : ` SELECT mode(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 54 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Mode_String" ,
q : ` SELECT mode(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . String ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : "a" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : "a" } ,
} } ,
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : "cxxx" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 6 * Second , Value : "zzzz" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 7 * Second , Value : "zzzz" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 8 * Second , Value : "zxxx" } ,
} } ,
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : "b" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : "d" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : "d" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : "d" } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "a" } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "d" } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { "zzzz" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Mode_Boolean" ,
q : ` SELECT mode(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Boolean ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : true } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : false } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 2 * Second , Value : false } ,
} } ,
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : true } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 6 * Second , Value : false } ,
} } ,
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : false } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : true } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : false } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : true } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { false } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { true } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { true } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Top_NoTags_Float" ,
q : ` SELECT top(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 4 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Top_NoTags_Integer" ,
q : ` SELECT top(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 19 ) } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 100 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 5 ) } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 4 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Top_NoTags_Unsigned" ,
q : ` SELECT top(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 19 ) } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 100 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 5 ) } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 4 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Top_Tags_Float" ,
q : ` SELECT top(value::float, host::tag, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
expr : ` max(value::float) ` ,
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) , "A" } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) , "B" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) , "A" } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 5 ) , "B" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Top_Tags_Integer" ,
q : ` SELECT top(value::integer, host::tag, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
expr : ` max(value::integer) ` ,
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) , "A" } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 10 ) , "B" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 100 ) , "A" } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 5 ) , "B" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Top_Tags_Unsigned" ,
q : ` SELECT top(value::Unsigned, host::tag, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s) fill(none) ` ,
typ : influxql . Unsigned ,
expr : ` max(value::Unsigned) ` ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) , "A" } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 10 ) , "B" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 100 ) , "A" } } ,
{ Time : 53 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 5 ) , "B" } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Top_GroupByTags_Float" ,
q : ` SELECT top(value::float, host::tag, 1) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY region, time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
expr : ` max(value::float) ` ,
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 9 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=east" ) } , Values : [ ] interface { } { float64 ( 19 ) , "A" } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { float64 ( 20 ) , "A" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { float64 ( 100 ) , "A" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Top_GroupByTags_Integer" ,
q : ` SELECT top(value::integer, host::tag, 1) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY region, time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 9 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=east" ) } , Values : [ ] interface { } { int64 ( 19 ) , "A" } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { int64 ( 20 ) , "A" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { int64 ( 100 ) , "A" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Top_GroupByTags_Unsigned" ,
q : ` SELECT top(value::Unsigned, host::tag, 1) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY region, time(30s) fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 9 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=east" ) } , Values : [ ] interface { } { uint64 ( 19 ) , "A" } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { uint64 ( 20 ) , "A" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { uint64 ( 100 ) , "A" } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Bottom_NoTags_Float" ,
q : ` SELECT bottom(value::float, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 51 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Bottom_NoTags_Integer" ,
q : ` SELECT bottom(value::integer, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 3 ) } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 100 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 1 ) } } ,
{ Time : 51 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Bottom_NoTags_Unsigned" ,
q : ` SELECT bottom(value::Unsigned, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 3 ) } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 100 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 51 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Bottom_Tags_Float" ,
q : ` SELECT bottom(value::float, host::tag, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
expr : ` min(value::float) ` ,
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) , "B" } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2 ) , "A" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) , "A" } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) , "B" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Bottom_Tags_Integer" ,
q : ` SELECT bottom(value::integer, host::tag, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 10 ) , "B" } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 2 ) , "A" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 100 ) , "A" } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 1 ) , "B" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Bottom_Tags_Unsigned" ,
q : ` SELECT bottom(value::Unsigned, host::tag, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(30s) fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 10 ) , "B" } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 2 ) , "A" } } ,
{ Time : 31 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 100 ) , "A" } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 1 ) , "B" } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-02 20:23:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Bottom_GroupByTags_Float" ,
q : ` SELECT bottom(value::float, host::tag, 1) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY region, time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
expr : ` min(value::float) ` ,
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=east" ) } , Values : [ ] interface { } { float64 ( 2 ) , "A" } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { float64 ( 3 ) , "A" } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { float64 ( 1 ) , "B" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Bottom_GroupByTags_Integer" ,
q : ` SELECT bottom(value::float, host::tag, 1) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY region, time(30s) fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
expr : ` min(value::float) ` ,
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=east" ) } , Values : [ ] interface { } { int64 ( 2 ) , "A" } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { int64 ( 3 ) , "A" } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { int64 ( 1 ) , "B" } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-02 20:23:06 +00:00
} ,
2017-09-18 16:28:37 +00:00
{
name : "Bottom_GroupByTags_Unsigned" ,
q : ` SELECT bottom(value::float, host::tag, 1) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY region, time(30s) fill(none) ` ,
typ : influxql . Unsigned ,
expr : ` min(value::float) ` ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 , Aux : [ ] interface { } { "A" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 , Aux : [ ] interface { } { "B" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 , Aux : [ ] interface { } { "B" } } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { "A" } } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 , Aux : [ ] interface { } { "A" } } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=east" ) } , Values : [ ] interface { } { uint64 ( 2 ) , "A" } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { uint64 ( 3 ) , "A" } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "region=west" ) } , Values : [ ] interface { } { uint64 ( 1 ) , "B" } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-09 16:25:16 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Fill_Null_Float" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(null) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Fill_Number_Float" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(1) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Fill_Previous_Float" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(previous) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2016-02-09 16:25:16 +00:00
} ,
2015-11-04 21:06:06 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Fill_Linear_Float_One" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 32 * Second , Value : 4 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
2015-11-04 21:06:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Fill_Linear_Float_Many" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 62 * Second , Value : 7 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 6 ) } } ,
{ Time : 60 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 7 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
2015-11-04 21:06:06 +00:00
} ,
{
2017-08-23 02:01:31 +00:00
name : "Fill_Linear_Float_MultipleSeries" ,
q : ` SELECT mean(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=B" ) , Time : 32 * Second , Value : 4 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
2015-11-04 21:06:06 +00:00
} ,
2016-02-01 22:08:37 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Fill_Linear_Integer_One" ,
q : ` SELECT max(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
expr : ` max(value::integer) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 32 * Second , Value : 4 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 1 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Fill_Linear_Integer_Many" ,
q : ` SELECT max(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:20Z' GROUP BY host, time(10s) fill(linear) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
expr : ` max(value::integer) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 72 * Second , Value : 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 1 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 5 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 7 ) } } ,
{ Time : 60 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 8 ) } } ,
{ Time : 70 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Fill_Linear_Integer_MultipleSeries" ,
q : ` SELECT max(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
expr : ` max(value::integer) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=B" ) , Time : 32 * Second , Value : 4 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-09-18 16:28:37 +00:00
name : "Fill_Linear_Unsigned_One" ,
q : ` SELECT max(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
typ : influxql . Unsigned ,
expr : ` max(value::Unsigned) ` ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 32 * Second , Value : 4 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
{
name : "Fill_Linear_Unsigned_Many" ,
q : ` SELECT max(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:20Z' GROUP BY host, time(10s) fill(linear) ` ,
typ : influxql . Unsigned ,
expr : ` max(value::Unsigned) ` ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 72 * Second , Value : 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 5 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 7 ) } } ,
{ Time : 60 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 8 ) } } ,
{ Time : 70 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
{
name : "Fill_Linear_Unsigned_MultipleSeries" ,
q : ` SELECT max(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:01:00Z' GROUP BY host, time(10s) fill(linear) ` ,
typ : influxql . Unsigned ,
expr : ` max(value::Unsigned) ` ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "host=A" ) , Time : 12 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "host=B" ) , Time : 32 * Second , Value : 4 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 4 ) } } ,
{ Time : 40 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
{
name : "Stddev_Float" ,
2017-08-23 02:01:31 +00:00
q : ` SELECT stddev(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 0.7071067811865476 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 0.7071067811865476 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { 1.5811388300841898 } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Stddev_Integer" ,
q : ` SELECT stddev(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 0.7071067811865476 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 0.7071067811865476 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { 1.5811388300841898 } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Stddev_Unsigned" ,
q : ` SELECT stddev(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 0.7071067811865476 } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { 0.7071067811865476 } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { nil } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { 1.5811388300841898 } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Spread_Float" ,
q : ` SELECT spread(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 4 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Spread_Integer" ,
q : ` SELECT spread(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 1 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 1 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 0 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 0 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 4 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Spread_Unsigned" ,
q : ` SELECT spread(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 1 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 5 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 4 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Percentile_Float" ,
q : ` SELECT percentile(value, 90) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 9 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 8 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 7 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 54 * Second , Value : 6 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 55 * Second , Value : 5 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 56 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 57 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 58 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 59 * Second , Value : 1 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 3 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 9 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Percentile_Integer" ,
q : ` SELECT percentile(value, 90) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 9 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 8 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 7 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 54 * Second , Value : 6 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 55 * Second , Value : 5 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 56 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 57 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 58 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 59 * Second , Value : 1 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 3 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 9 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Percentile_Unsigned" ,
q : ` SELECT percentile(value, 90) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 50 * Second , Value : 10 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 51 * Second , Value : 9 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 52 * Second , Value : 8 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 53 * Second , Value : 7 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 54 * Second , Value : 6 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 55 * Second , Value : 5 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 56 * Second , Value : 4 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 57 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 58 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 59 * Second , Value : 1 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 3 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 50 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 9 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Sample_Float" ,
q : ` SELECT sample(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 10 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 15 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 15 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Sample_Integer" ,
q : ` SELECT sample(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 10 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 15 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 19 ) } } ,
{ Time : 15 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { int64 ( 2 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Sample_Unsigned" ,
q : ` SELECT sample(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 10 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 15 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 19 ) } } ,
{ Time : 15 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-19 04:06:41 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Sample_String" ,
q : ` SELECT sample(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . String ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : "a" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 5 * Second , Value : "b" } ,
} } ,
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 10 * Second , Value : "c" } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 15 * Second , Value : "d" } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "a" } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { "b" } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { "c" } } ,
{ Time : 15 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { "d" } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Sample_Boolean" ,
q : ` SELECT sample(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Boolean ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : true } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 5 * Second , Value : false } ,
} } ,
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 10 * Second , Value : false } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=B" ) , Time : 15 * Second , Value : true } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { true } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { false } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { false } } ,
{ Time : 15 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { true } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2017-08-22 18:18:41 +00:00
//{
// name: "Raw",
// q: `SELECT v1::float, v2::float FROM cpu`,
// itrs: []query.Iterator{
// &FloatIterator{Points: []query.FloatPoint{
// {Time: 0, Aux: []interface{}{float64(1), nil}},
// {Time: 1, Aux: []interface{}{nil, float64(2)}},
// {Time: 5, Aux: []interface{}{float64(3), float64(4)}},
// }},
// },
// points: [][]query.Point{
// {
// &query.FloatPoint{Time: 0, Value: 1},
// &query.FloatPoint{Time: 0, Nil: true},
// },
// {
// &query.FloatPoint{Time: 1, Nil: true},
// &query.FloatPoint{Time: 1, Value: 2},
// },
// {
// &query.FloatPoint{Time: 5, Value: 3},
// &query.FloatPoint{Time: 5, Value: 4},
// },
// },
//},
2016-02-08 22:26:36 +00:00
{
2017-08-23 02:01:31 +00:00
name : "ParenExpr_Min" ,
q : ` SELECT (min(value)) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` min(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 11 * Second , Value : 3 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 31 * Second , Value : 100 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 30 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-08-23 02:01:31 +00:00
name : "ParenExpr_Distinct" ,
q : ` SELECT (distinct(value)) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-02T00:00:00Z' GROUP BY time(10s), host fill(none) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=A" ) , Time : 1 * Second , Value : 19 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=west,host=B" ) , Time : 5 * Second , Value : 10 } ,
} } ,
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 9 * Second , Value : 19 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 10 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 11 * Second , Value : 2 } ,
{ Name : "cpu" , Tags : ParseTags ( "region=east,host=A" ) , Time : 12 * Second , Value : 2 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 10 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=A" ) } , Values : [ ] interface { } { float64 ( 2 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" , Tags : ParseTags ( "host=B" ) } , Values : [ ] interface { } { float64 ( 10 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Derivative_Float" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.5 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2.25 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 4 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-08-23 02:01:31 +00:00
name : "Derivative_Integer" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.5 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2.25 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 4 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Derivative_Unsigned" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.5 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2.25 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 4 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-19 04:06:41 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Derivative_Desc_Float" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ORDER BY desc ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 4 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.25 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2.5 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Derivative_Desc_Integer" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ORDER BY desc ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 4 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.25 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2.5 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Derivative_Desc_Unsigned" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ORDER BY desc ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 4 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.25 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2.5 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-08-23 02:01:31 +00:00
name : "Derivative_Duplicate_Float" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.5 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Derivative_Duplicate_Integer" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.5 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Derivative_Duplicate_Unsigned" ,
q : ` SELECT derivative(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 2.5 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "Difference_Float" ,
q : ` SELECT difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 10 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 16 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Difference_Integer" ,
q : ` SELECT difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( - 10 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 9 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( - 16 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Difference_Unsigned" ,
q : ` SELECT difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 18446744073709551606 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 18446744073709551600 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "Difference_Duplicate_Float" ,
q : ` SELECT difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 10 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Difference_Duplicate_Integer" ,
q : ` SELECT difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( - 10 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Difference_Duplicate_Unsigned" ,
q : ` SELECT difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 18446744073709551606 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "Non_Negative_Difference_Float" ,
q : ` SELECT non_negative_difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 29 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 39 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) } } ,
{ Time : 16 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 36 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Non_Negative_Difference_Integer" ,
q : ` SELECT non_negative_difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 21 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 11 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Non_Negative_Difference_Unsigned" ,
q : ` SELECT non_negative_difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 21 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 11 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "Non_Negative_Difference_Duplicate_Float" ,
q : ` SELECT non_negative_difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 30 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 40 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 16 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 30 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Non_Negative_Difference_Duplicate_Integer" ,
q : ` SELECT non_negative_difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 30 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 40 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 16 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 30 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Non_Negative_Difference_Duplicate_Unsigned" ,
q : ` SELECT non_negative_difference(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 30 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 40 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 16 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 30 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "Elapsed_Float" ,
q : ` SELECT elapsed(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 11 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 3 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Elapsed_Integer" ,
q : ` SELECT elapsed(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 11 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 3 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Elapsed_Unsigned" ,
q : ` SELECT elapsed(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 11 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 3 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "Elapsed_String" ,
q : ` SELECT elapsed(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . String ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& StringIterator { Points : [ ] query . StringPoint {
{ Name : "cpu" , Time : 0 * Second , Value : "a" } ,
{ Name : "cpu" , Time : 4 * Second , Value : "b" } ,
{ Name : "cpu" , Time : 8 * Second , Value : "c" } ,
{ Name : "cpu" , Time : 11 * Second , Value : "d" } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 3 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Elapsed_Boolean" ,
q : ` SELECT elapsed(value, 1s) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Boolean ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& BooleanIterator { Points : [ ] query . BooleanPoint {
{ Name : "cpu" , Time : 0 * Second , Value : true } ,
{ Name : "cpu" , Time : 4 * Second , Value : false } ,
{ Name : "cpu" , Time : 8 * Second , Value : false } ,
{ Name : "cpu" , Time : 11 * Second , Value : true } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 4 ) } } ,
{ Time : 11 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 3 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Integral_Float" ,
q : ` SELECT integral(value) FROM cpu ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 10 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 15 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 20 * Second , Value : 0 } ,
{ Name : "cpu" , Time : 30 * Second , Value : - 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 50 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Integral_Duplicate_Float" ,
q : ` SELECT integral(value) FROM cpu ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 30 } ,
{ Name : "cpu" , Time : 10 * Second , Value : 40 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 250 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Integral_Float_GroupByTime" ,
q : ` SELECT integral(value) FROM cpu WHERE time > 0s AND time < 60s GROUP BY time(20s) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 10 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 15 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 20 * Second , Value : 0 } ,
{ Name : "cpu" , Time : 30 * Second , Value : - 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 50 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Integral_Float_InterpolateGroupByTime" ,
q : ` SELECT integral(value) FROM cpu WHERE time > 0s AND time < 60s GROUP BY time(20s) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 10 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 15 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 25 * Second , Value : 0 } ,
{ Name : "cpu" , Time : 30 * Second , Value : - 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 112.5 ) } } ,
{ Time : 20 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 12.5 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Integral_Integer" ,
q : ` SELECT integral(value) FROM cpu ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 10 * Second , Value : 0 } ,
{ Name : "cpu" , Time : 20 * Second , Value : - 10 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 50 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "Integral_Duplicate_Integer" ,
q : ` SELECT integral(value, 2s) FROM cpu ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 30 } ,
{ Name : "cpu" , Time : 10 * Second , Value : 40 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 125 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "Integral_Unsigned" ,
q : ` SELECT integral(value) FROM cpu ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 10 * Second , Value : 0 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
{
name : "Integral_Duplicate_Unsigned" ,
q : ` SELECT integral(value, 2s) FROM cpu ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 5 * Second , Value : 30 } ,
{ Name : "cpu" , Time : 10 * Second , Value : 40 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 125 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "MovingAverage_Float" ,
q : ` SELECT moving_average(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 15 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 14.5 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 11 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "MovingAverage_Integer" ,
q : ` SELECT moving_average(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 15 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 14.5 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 11 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "MovingAverage_Unsigned" ,
q : ` SELECT moving_average(value, 2) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 15 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 14.5 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 11 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "CumulativeSum_Float" ,
q : ` SELECT cumulative_sum(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 30 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 49 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 52 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "CumulativeSum_Integer" ,
q : ` SELECT cumulative_sum(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 30 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 49 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 52 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "CumulativeSum_Unsigned" ,
q : ` SELECT cumulative_sum(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 8 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 30 ) } } ,
{ Time : 8 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 49 ) } } ,
{ Time : 12 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 52 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "CumulativeSum_Duplicate_Float" ,
q : ` SELECT cumulative_sum(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 39 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 49 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 52 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
name : "CumulativeSum_Duplicate_Integer" ,
q : ` SELECT cumulative_sum(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Integer ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& IntegerIterator { Points : [ ] query . IntegerPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 39 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 49 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 52 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-09-18 16:28:37 +00:00
{
name : "CumulativeSum_Duplicate_Unsigned" ,
q : ` SELECT cumulative_sum(value) FROM cpu WHERE time >= '1970-01-01T00:00:00Z' AND time < '1970-01-01T00:00:16Z' ` ,
typ : influxql . Unsigned ,
itrs : [ ] query . Iterator {
& UnsignedIterator { Points : [ ] query . UnsignedPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 } ,
{ Name : "cpu" , Time : 0 * Second , Value : 19 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 4 * Second , Value : 3 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 39 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 49 ) } } ,
{ Time : 4 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 52 ) } } ,
2017-09-18 16:28:37 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
name : "HoltWinters_GroupBy_Agg" ,
q : ` SELECT holt_winters(mean(value), 2, 2) FROM cpu WHERE time >= '1970-01-01T00:00:10Z' AND time < '1970-01-01T00:00:20Z' GROUP BY time(2s) ` ,
2017-08-22 18:18:41 +00:00
typ : influxql . Float ,
expr : ` mean(value::float) ` ,
2017-08-23 02:01:31 +00:00
itrs : [ ] query . Iterator {
& FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 10 * Second , Value : 4 } ,
{ Name : "cpu" , Time : 11 * Second , Value : 6 } ,
{ Name : "cpu" , Time : 12 * Second , Value : 9 } ,
{ Name : "cpu" , Time : 13 * Second , Value : 11 } ,
{ Name : "cpu" , Time : 14 * Second , Value : 5 } ,
{ Name : "cpu" , Time : 15 * Second , Value : 7 } ,
{ Name : "cpu" , Time : 16 * Second , Value : 10 } ,
{ Name : "cpu" , Time : 17 * Second , Value : 12 } ,
{ Name : "cpu" , Time : 18 * Second , Value : 6 } ,
{ Name : "cpu" , Time : 19 * Second , Value : 8 } ,
} } ,
} ,
2018-03-01 20:12:22 +00:00
rows : [ ] query . Row {
{ Time : 20 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { 11.960623419918432 } } ,
{ Time : 22 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { 7.953140268154609 } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
} {
t . Run ( tt . name , func ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , _ influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"value" : tt . typ ,
} ,
Dimensions : [ ] string { "host" , "region" } ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-22 18:18:41 +00:00
if m . Name != "cpu" {
t . Fatalf ( "unexpected source: %s" , m . Name )
}
if tt . expr != "" && ! reflect . DeepEqual ( opt . Expr , MustParseExpr ( tt . expr ) ) {
t . Fatalf ( "unexpected expr: %s" , spew . Sdump ( opt . Expr ) )
}
2017-08-23 02:01:31 +00:00
2017-08-22 18:18:41 +00:00
itrs := tt . itrs
if _ , ok := opt . Expr . ( * influxql . Call ) ; ok {
for i , itr := range itrs {
itr , err := query . NewCallIterator ( itr , opt )
if err != nil {
return nil , err
}
itrs [ i ] = itr
}
}
return query . Iterators ( itrs ) . Merge ( opt )
} ,
2017-08-23 02:01:31 +00:00
}
2017-08-22 18:18:41 +00:00
} ,
2017-08-23 02:01:31 +00:00
}
2018-03-01 20:12:22 +00:00
stmt := MustParseSelectStatement ( tt . q )
stmt . OmitTime = true
cur , err := query . Select ( context . Background ( ) , stmt , & shardMapper , query . SelectOptions { } )
2017-08-23 02:01:31 +00:00
if err != nil {
if tt . err == "" {
t . Fatal ( err )
} else if have , want := err . Error ( ) , tt . err ; have != want {
t . Fatalf ( "unexpected error: have=%s want=%s" , have , want )
}
} else if tt . err != "" {
t . Fatal ( "expected error" )
2018-03-01 20:12:22 +00:00
} else if a , err := ReadCursor ( cur ) ; err != nil {
2017-08-23 02:01:31 +00:00
t . Fatalf ( "unexpected point: %s" , err )
2018-03-01 20:12:22 +00:00
} else if diff := cmp . Diff ( a , tt . rows ) ; diff != "" {
2017-08-23 02:01:31 +00:00
t . Fatalf ( "unexpected points:\n%s" , diff )
}
} )
}
}
2017-09-18 16:28:37 +00:00
// Ensure a SELECT with raw fields works for all types.
func TestSelect_Raw ( t * testing . T ) {
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , _ influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"f" : influxql . Float ,
"i" : influxql . Integer ,
"u" : influxql . Unsigned ,
"s" : influxql . String ,
"b" : influxql . Boolean ,
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-09-18 16:28:37 +00:00
if m . Name != "cpu" {
t . Fatalf ( "unexpected source: %s" , m . Name )
}
if ! reflect . DeepEqual ( opt . Aux , [ ] influxql . VarRef {
{ Val : "b" , Type : influxql . Boolean } ,
{ Val : "f" , Type : influxql . Float } ,
{ Val : "i" , Type : influxql . Integer } ,
{ Val : "s" , Type : influxql . String } ,
{ Val : "u" , Type : influxql . Unsigned } ,
} ) {
t . Fatalf ( "unexpected auxiliary fields: %v" , opt . Aux )
}
return & FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Aux : [ ] interface { } {
true , float64 ( 20 ) , int64 ( 20 ) , "a" , uint64 ( 20 ) } } ,
{ Name : "cpu" , Time : 5 * Second , Aux : [ ] interface { } {
false , float64 ( 10 ) , int64 ( 10 ) , "b" , uint64 ( 10 ) } } ,
{ Name : "cpu" , Time : 9 * Second , Aux : [ ] interface { } {
true , float64 ( 19 ) , int64 ( 19 ) , "c" , uint64 ( 19 ) } } ,
} } , nil
} ,
}
} ,
}
stmt := MustParseSelectStatement ( ` SELECT f, i, u, s, b FROM cpu ` )
2018-03-01 20:12:22 +00:00
stmt . OmitTime = true
cur , err := query . Select ( context . Background ( ) , stmt , & shardMapper , query . SelectOptions { } )
2017-09-18 16:28:37 +00:00
if err != nil {
t . Errorf ( "parse error: %s" , err )
2018-03-01 20:12:22 +00:00
} else if a , err := ReadCursor ( cur ) ; err != nil {
2017-09-18 16:28:37 +00:00
t . Fatalf ( "unexpected error: %s" , err )
2018-03-01 20:12:22 +00:00
} else if diff := cmp . Diff ( a , [ ] query . Row {
2017-09-18 16:28:37 +00:00
{
2018-03-01 20:12:22 +00:00
Time : 0 * Second ,
Series : query . Series {
Name : "cpu" ,
} ,
Values : [ ] interface { } { float64 ( 20 ) , int64 ( 20 ) , uint64 ( 20 ) , "a" , true } ,
2017-09-18 16:28:37 +00:00
} ,
{
2018-03-01 20:12:22 +00:00
Time : 5 * Second ,
Series : query . Series {
Name : "cpu" ,
} ,
Values : [ ] interface { } { float64 ( 10 ) , int64 ( 10 ) , uint64 ( 10 ) , "b" , false } ,
2017-09-18 16:28:37 +00:00
} ,
{
2018-03-01 20:12:22 +00:00
Time : 9 * Second ,
Series : query . Series {
Name : "cpu" ,
} ,
Values : [ ] interface { } { float64 ( 19 ) , int64 ( 19 ) , uint64 ( 19 ) , "c" , true } ,
2017-09-18 16:28:37 +00:00
} ,
} ) ; diff != "" {
t . Errorf ( "unexpected points:\n%s" , diff )
}
}
2017-08-23 02:01:31 +00:00
// Ensure a SELECT binary expr queries can be executed as floats.
2017-10-02 17:31:07 +00:00
func TestSelect_BinaryExpr ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , _ influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
2017-10-02 17:31:07 +00:00
"f" : influxql . Float ,
"i" : influxql . Integer ,
"u" : influxql . Unsigned ,
2017-08-22 18:18:41 +00:00
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-22 18:18:41 +00:00
if m . Name != "cpu" {
t . Fatalf ( "unexpected source: %s" , m . Name )
}
2017-10-02 17:31:07 +00:00
makeAuxFields := func ( value int ) [ ] interface { } {
2017-08-22 18:18:41 +00:00
aux := make ( [ ] interface { } , len ( opt . Aux ) )
for i := range aux {
2017-10-02 17:31:07 +00:00
switch opt . Aux [ i ] . Type {
case influxql . Float :
aux [ i ] = float64 ( value )
case influxql . Integer :
aux [ i ] = int64 ( value )
case influxql . Unsigned :
aux [ i ] = uint64 ( value )
}
2017-08-22 18:18:41 +00:00
}
return aux
}
return & FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Aux : makeAuxFields ( 20 ) } ,
{ Name : "cpu" , Time : 5 * Second , Aux : makeAuxFields ( 10 ) } ,
{ Name : "cpu" , Time : 9 * Second , Aux : makeAuxFields ( 19 ) } ,
} } , nil
} ,
2017-08-23 02:01:31 +00:00
}
2017-08-22 18:18:41 +00:00
} ,
2017-08-23 02:01:31 +00:00
}
for _ , test := range [ ] struct {
Name string
Statement string
2018-03-01 20:12:22 +00:00
Rows [ ] query . Row
2017-10-02 17:31:07 +00:00
Err string
2017-08-23 02:01:31 +00:00
} {
{
2017-10-02 17:31:07 +00:00
Name : "Float_AdditionRHS_Number" ,
Statement : ` SELECT f + 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_AdditionRHS_Number" ,
Statement : ` SELECT i + 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_AdditionRHS_Number" ,
Statement : ` SELECT u + 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2016-02-19 04:06:41 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_AdditionRHS_Integer" ,
Statement : ` SELECT f + 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Integer_AdditionRHS_Integer" ,
Statement : ` SELECT i + 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 21 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_AdditionRHS_Integer" ,
Statement : ` SELECT u + 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 21 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Float_AdditionRHS_Unsigned" ,
Statement : ` SELECT f + 9223372036854775808 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row { // adding small floats to this does not change the value, this is expected
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775808 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775808 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775808 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_AdditionRHS_Unsigned" ,
Statement : ` SELECT i + 9223372036854775808 FROM cpu ` ,
Err : ` cannot use + with an integer and unsigned ` ,
} ,
{
Name : "Unsigned_AdditionRHS_Unsigned" ,
Statement : ` SELECT u + 9223372036854775808 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775828 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775818 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775827 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2016-02-19 04:06:41 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_AdditionLHS_Number" ,
Statement : ` SELECT 2.0 + f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Integer_AdditionLHS_Number" ,
Statement : ` SELECT 2.0 + i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_AdditionLHS_Number" ,
Statement : ` SELECT 2.0 + u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Float_AdditionLHS_Integer" ,
Statement : ` SELECT 2 + f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 21 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_AdditionLHS_Integer" ,
Statement : ` SELECT 2 + i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 21 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2016-02-19 04:06:41 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_AdditionLHS_Integer" ,
Statement : ` SELECT 2 + u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 22 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 12 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 21 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_AdditionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 + f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row { // adding small floats to this does not change the value, this is expected
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775808 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775808 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775808 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_AdditionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 + i FROM cpu ` ,
Err : ` cannot use + with unsigned and an integer ` ,
} ,
{
Name : "Unsigned_AdditionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 + u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775828 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775818 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775827 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2016-02-01 22:08:37 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_Add_Float" ,
Statement : ` SELECT f + f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_Add_Integer" ,
Statement : ` SELECT i + i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 38 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_Add_Unsigned" ,
Statement : ` SELECT u + u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 38 ) } } ,
2016-02-01 22:08:37 +00:00
} ,
} ,
2016-02-19 04:06:41 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_Add_Integer" ,
Statement : ` SELECT f + i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-19 04:06:41 +00:00
} ,
} ,
2016-02-08 22:26:36 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_Add_Unsigned" ,
Statement : ` SELECT f + u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-08 22:26:36 +00:00
} ,
} ,
2017-10-02 17:31:07 +00:00
{
Name : "Integer_Add_Unsigned" ,
Statement : ` SELECT i + u FROM cpu ` ,
Err : ` cannot use + between an integer and unsigned, an explicit cast is required ` ,
2017-08-22 18:18:41 +00:00
} ,
2016-02-18 21:37:03 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_MultiplicationRHS_Number" ,
Statement : ` SELECT f * 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-18 21:37:03 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_MultiplicationRHS_Number" ,
Statement : ` SELECT i * 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-18 21:37:03 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_MultiplicationRHS_Number" ,
Statement : ` SELECT u * 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-18 21:37:03 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Float_MultiplicationRHS_Integer" ,
Statement : ` SELECT f * 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-02-18 21:37:03 +00:00
} ,
} ,
2017-03-19 09:58:09 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Integer_MultiplicationRHS_Integer" ,
Statement : ` SELECT i * 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 38 ) } } ,
2017-03-19 09:58:09 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_MultiplicationRHS_Integer" ,
Statement : ` SELECT u * 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 38 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
// Skip unsigned literals for multiplication because there is inevitable
2018-03-01 20:12:22 +00:00
// overflow. While it is possible to do, the behavior is considered undefined
2017-10-02 17:31:07 +00:00
// and it's not a very good test because it would result in just plugging
// the values into the computer anyway to figure out what the correct answer
// is rather than calculating it myself and testing that I get the correct
// value.
{
Name : "Float_MultiplicationLHS_Number" ,
Statement : ` SELECT 2.0 * f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2017-03-19 09:58:09 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_MultiplicationLHS_Number" ,
Statement : ` SELECT 2.0 * i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Unsigned_MultiplicationLHS_Number" ,
Statement : ` SELECT 2.0 * u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2017-03-19 09:58:09 +00:00
} ,
} ,
2016-03-11 15:58:16 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_MultiplicationLHS_Integer" ,
Statement : ` SELECT 2 * f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 38 ) } } ,
2016-03-11 15:58:16 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_MultiplicationLHS_Integer" ,
Statement : ` SELECT 2 * i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 38 ) } } ,
2016-03-11 15:58:16 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_MultiplicationLHS_Integer" ,
Statement : ` SELECT 2 * u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 40 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 38 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
// Skip unsigned literals for multiplication. See above.
{
Name : "Float_Multiply_Float" ,
Statement : ` SELECT f * f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 400 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 361 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_Multiply_Integer" ,
Statement : ` SELECT i * i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 400 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 100 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 361 ) } } ,
2016-03-11 15:58:16 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_Multiply_Unsigned" ,
Statement : ` SELECT u * u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 400 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 100 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 361 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_Multiply_Integer" ,
Statement : ` SELECT f * i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 400 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 361 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_Multiply_Unsigned" ,
Statement : ` SELECT f * u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 400 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 100 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 361 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_Multiply_Unsigned" ,
Statement : ` SELECT i * u FROM cpu ` ,
Err : ` cannot use * between an integer and unsigned, an explicit cast is required ` ,
} ,
{
Name : "Float_SubtractionRHS_Number" ,
Statement : ` SELECT f - 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_SubtractionRHS_Number" ,
Statement : ` SELECT i - 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Unsigned_SubtractionRHS_Number" ,
Statement : ` SELECT u - 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 17 ) } } ,
2016-03-11 15:58:16 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_SubtractionRHS_Integer" ,
Statement : ` SELECT f - 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_SubtractionRHS_Integer" ,
Statement : ` SELECT i - 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Unsigned_SubtractionRHS_Integer" ,
Statement : ` SELECT u - 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_SubtractionRHS_Unsigned" ,
Statement : ` SELECT f - 9223372036854775808 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row { // adding small floats to this does not change the value, this is expected
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 9223372036854775808 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 9223372036854775808 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 9223372036854775808 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_SubtractionRHS_Unsigned" ,
Statement : ` SELECT i - 9223372036854775808 FROM cpu ` ,
Err : ` cannot use - with an integer and unsigned ` ,
2017-08-23 02:01:31 +00:00
} ,
2017-10-02 17:31:07 +00:00
// Skip Unsigned_SubtractionRHS_Integer because it would result in underflow.
{
Name : "Float_SubtractionLHS_Number" ,
Statement : ` SELECT 2.0 - f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_SubtractionLHS_Number" ,
Statement : ` SELECT 2.0 - i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Unsigned_SubtractionLHS_Number" ,
Statement : ` SELECT 2.0 - u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 17 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
2017-08-23 02:01:31 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Float_SubtractionLHS_Integer" ,
Statement : ` SELECT 2 - f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 17 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_SubtractionLHS_Integer" ,
Statement : ` SELECT 2 - i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( - 18 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( - 8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( - 17 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_SubtractionLHS_Integer" ,
Statement : ` SELECT 30 - u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 11 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_SubtractionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 - f FROM cpu ` , // subtracting small floats to this does not change the value, this is expected
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775828 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775828 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 9223372036854775828 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_SubtractionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 - i FROM cpu ` ,
Err : ` cannot use - with unsigned and an integer ` ,
} ,
{
Name : "Unsigned_SubtractionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 - u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775788 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775798 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9223372036854775789 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_Subtract_Float" ,
Statement : ` SELECT f - f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_Subtract_Integer" ,
Statement : ` SELECT i - i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 0 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_Subtract_Unsigned" ,
Statement : ` SELECT u - u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_Subtract_Integer" ,
Statement : ` SELECT f - i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_Subtract_Unsigned" ,
Statement : ` SELECT f - u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 0 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_Subtract_Unsigned" ,
Statement : ` SELECT i - u FROM cpu ` ,
Err : ` cannot use - between an integer and unsigned, an explicit cast is required ` ,
} ,
{
Name : "Float_DivisionRHS_Number" ,
Statement : ` SELECT f / 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) / 2 } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_DivisionRHS_Number" ,
Statement : ` SELECT i / 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) / 2 } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_DivisionRHS_Number" ,
Statement : ` SELECT u / 2.0 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) / 2 } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_DivisionRHS_Integer" ,
Statement : ` SELECT f / 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) / 2 } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_DivisionRHS_Integer" ,
Statement : ` SELECT i / 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) / 2 } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_DivisionRHS_Integer" ,
Statement : ` SELECT u / 2 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 9 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_DivisionRHS_Unsigned" ,
Statement : ` SELECT f / 9223372036854775808 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row { // dividing small floats does not result in a meaningful result, this is expected
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 20 ) / float64 ( 9223372036854775808 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) / float64 ( 9223372036854775808 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 19 ) / float64 ( 9223372036854775808 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_DivisionRHS_Unsigned" ,
Statement : ` SELECT i / 9223372036854775808 FROM cpu ` ,
Err : ` cannot use / with an integer and unsigned ` ,
} ,
{
Name : "Unsigned_DivisionRHS_Unsigned" ,
Statement : ` SELECT u / 9223372036854775808 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_DivisionLHS_Number" ,
Statement : ` SELECT 38.0 / f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1.9 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 3.8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_DivisionLHS_Number" ,
Statement : ` SELECT 38.0 / i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1.9 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 3.8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Unsigned_DivisionLHS_Number" ,
Statement : ` SELECT 38.0 / u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1.9 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 3.8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Float_DivisionLHS_Integer" ,
Statement : ` SELECT 38 / f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1.9 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 3.8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_DivisionLHS_Integer" ,
Statement : ` SELECT 38 / i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1.9 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 3.8 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 2 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_DivisionLHS_Integer" ,
Statement : ` SELECT 38 / u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 3 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 2 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_DivisionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 / f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row { // dividing large floats results in inaccurate outputs so these may not be correct, but that is considered normal for floating point
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 461168601842738816 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 922337203685477632 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 485440633518672384 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_DivisionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 / i FROM cpu ` ,
Err : ` cannot use / with unsigned and an integer ` ,
} ,
{
Name : "Unsigned_DivisionLHS_Unsigned" ,
Statement : ` SELECT 9223372036854775808 / u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 461168601842738790 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 922337203685477580 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 485440633518672410 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Float_Divide_Float" ,
Statement : ` SELECT f / f FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_Divide_Integer" ,
Statement : ` SELECT i / i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_Divide_Unsigned" ,
Statement : ` SELECT u / u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Float_Divide_Integer" ,
Statement : ` SELECT f / i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
2017-10-02 17:31:07 +00:00
{
Name : "Float_Divide_Unsigned" ,
Statement : ` SELECT f / u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 1 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
2017-08-22 18:18:41 +00:00
} ,
2017-08-23 02:01:31 +00:00
{
2017-10-02 17:31:07 +00:00
Name : "Integer_Divide_Unsigned" ,
Statement : ` SELECT i / u FROM cpu ` ,
Err : ` cannot use / between an integer and unsigned, an explicit cast is required ` ,
} ,
{
Name : "Integer_BitwiseAndRHS" ,
Statement : ` SELECT i & 254 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 10 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 18 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_BitwiseAndRHS" ,
Statement : ` SELECT u & 254 FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 10 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 18 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Integer_BitwiseOrLHS" ,
Statement : ` SELECT 4 | i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 14 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 23 ) } } ,
2017-10-02 17:31:07 +00:00
} ,
} ,
{
Name : "Unsigned_BitwiseOrLHS" ,
Statement : ` SELECT 4 | u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 20 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 14 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 23 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Integer_BitwiseXOr_Integer" ,
Statement : ` SELECT i ^ i FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { int64 ( 0 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
2017-10-02 17:31:07 +00:00
Name : "Unsigned_BitwiseXOr_Integer" ,
Statement : ` SELECT u ^ u FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { uint64 ( 0 ) } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
} {
t . Run ( test . Name , func ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
stmt := MustParseSelectStatement ( test . Statement )
2018-03-01 20:12:22 +00:00
stmt . OmitTime = true
cur , err := query . Select ( context . Background ( ) , stmt , & shardMapper , query . SelectOptions { } )
2017-08-23 02:01:31 +00:00
if err != nil {
2017-10-02 17:31:07 +00:00
if have , want := err . Error ( ) , test . Err ; want != "" {
if have != want {
t . Errorf ( "%s: unexpected parse error: %s != %s" , test . Name , have , want )
}
} else {
t . Errorf ( "%s: unexpected parse error: %s" , test . Name , have )
}
} else if test . Err != "" {
t . Fatalf ( "%s: expected error" , test . Name )
2018-03-01 20:12:22 +00:00
} else if a , err := ReadCursor ( cur ) ; err != nil {
2017-08-23 02:01:31 +00:00
t . Fatalf ( "%s: unexpected error: %s" , test . Name , err )
2018-03-01 20:12:22 +00:00
} else if diff := cmp . Diff ( a , test . Rows ) ; diff != "" {
2017-08-23 02:01:31 +00:00
t . Errorf ( "%s: unexpected points:\n%s" , test . Name , diff )
}
} )
2016-11-06 12:54:26 +00:00
}
}
2017-08-23 02:01:31 +00:00
// Ensure a SELECT binary expr queries can be executed as booleans.
func TestSelect_BinaryExpr_Boolean ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , _ influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"one" : influxql . Boolean ,
"two" : influxql . Boolean ,
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-22 18:18:41 +00:00
if m . Name != "cpu" {
t . Fatalf ( "unexpected source: %s" , m . Name )
}
makeAuxFields := func ( value bool ) [ ] interface { } {
aux := make ( [ ] interface { } , len ( opt . Aux ) )
for i := range aux {
aux [ i ] = value
}
return aux
}
return & FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Aux : makeAuxFields ( true ) } ,
{ Name : "cpu" , Time : 5 * Second , Aux : makeAuxFields ( false ) } ,
{ Name : "cpu" , Time : 9 * Second , Aux : makeAuxFields ( true ) } ,
} } , nil
} ,
2017-08-23 02:01:31 +00:00
}
2017-08-22 18:18:41 +00:00
} ,
2016-10-07 15:11:50 +00:00
}
2017-08-23 02:01:31 +00:00
for _ , test := range [ ] struct {
Name string
Statement string
2018-03-01 20:12:22 +00:00
Rows [ ] query . Row
2017-08-23 02:01:31 +00:00
} {
{
Name : "BinaryXOrRHS" ,
Statement : ` SELECT one ^ true FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { false } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { true } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { false } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
Name : "BinaryOrLHS" ,
Statement : ` SELECT true | two FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { true } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { true } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { true } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
Name : "TwoSeriesBitwiseAnd" ,
Statement : ` SELECT one & two FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { true } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { false } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { true } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
} {
t . Run ( test . Name , func ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
stmt := MustParseSelectStatement ( test . Statement )
2018-03-01 20:12:22 +00:00
stmt . OmitTime = true
cur , err := query . Select ( context . Background ( ) , stmt , & shardMapper , query . SelectOptions { } )
2017-08-23 02:01:31 +00:00
if err != nil {
t . Errorf ( "%s: parse error: %s" , test . Name , err )
2018-03-01 20:12:22 +00:00
} else if a , err := ReadCursor ( cur ) ; err != nil {
2017-08-23 02:01:31 +00:00
t . Fatalf ( "%s: unexpected error: %s" , test . Name , err )
2018-03-01 20:12:22 +00:00
} else if diff := cmp . Diff ( a , test . Rows ) ; diff != "" {
2017-08-23 02:01:31 +00:00
t . Errorf ( "%s: unexpected points:\n%s" , test . Name , diff )
}
} )
2016-10-07 15:11:50 +00:00
}
}
2017-08-23 02:01:31 +00:00
// Ensure a SELECT binary expr with nil values can be executed.
// Nil values may be present when a field is missing from one iterator,
// but not the other.
func TestSelect_BinaryExpr_NilValues ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , _ influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"total" : influxql . Float ,
"value" : influxql . Float ,
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-22 18:18:41 +00:00
if m . Name != "cpu" {
t . Fatalf ( "unexpected source: %s" , m . Name )
}
return & FloatIterator { Points : [ ] query . FloatPoint {
{ Name : "cpu" , Time : 0 * Second , Value : 20 , Aux : [ ] interface { } { float64 ( 20 ) , nil } } ,
{ Name : "cpu" , Time : 5 * Second , Value : 10 , Aux : [ ] interface { } { float64 ( 10 ) , float64 ( 15 ) } } ,
{ Name : "cpu" , Time : 9 * Second , Value : 19 , Aux : [ ] interface { } { nil , float64 ( 5 ) } } ,
} } , nil
} ,
}
} ,
2016-10-07 15:11:50 +00:00
}
2016-05-12 21:11:19 +00:00
2017-08-23 02:01:31 +00:00
for _ , test := range [ ] struct {
Name string
Statement string
2018-03-01 20:12:22 +00:00
Rows [ ] query . Row
2017-08-23 02:01:31 +00:00
} {
{
Name : "Addition" ,
Statement : ` SELECT total + value FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 25 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
Name : "Subtraction" ,
Statement : ` SELECT total - value FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( - 5 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
Name : "Multiplication" ,
Statement : ` SELECT total * value FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 150 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
{
Name : "Division" ,
Statement : ` SELECT total / value FROM cpu ` ,
2018-03-01 20:12:22 +00:00
Rows : [ ] query . Row {
{ Time : 0 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
{ Time : 5 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { float64 ( 10 ) / float64 ( 15 ) } } ,
{ Time : 9 * Second , Series : query . Series { Name : "cpu" } , Values : [ ] interface { } { nil } } ,
2017-08-23 02:01:31 +00:00
} ,
} ,
} {
t . Run ( test . Name , func ( t * testing . T ) {
2017-08-22 18:18:41 +00:00
stmt := MustParseSelectStatement ( test . Statement )
2018-03-01 20:12:22 +00:00
stmt . OmitTime = true
cur , err := query . Select ( context . Background ( ) , stmt , & shardMapper , query . SelectOptions { } )
2017-08-23 02:01:31 +00:00
if err != nil {
t . Errorf ( "%s: parse error: %s" , test . Name , err )
2018-03-01 20:12:22 +00:00
} else if a , err := ReadCursor ( cur ) ; err != nil {
2017-08-23 02:01:31 +00:00
t . Fatalf ( "%s: unexpected error: %s" , test . Name , err )
2018-03-01 20:12:22 +00:00
} else if diff := cmp . Diff ( a , test . Rows ) ; diff != "" {
2017-08-23 02:01:31 +00:00
t . Errorf ( "%s: unexpected points:\n%s" , test . Name , diff )
}
2017-08-22 18:18:41 +00:00
} )
}
}
type ShardMapper struct {
MapShardsFn func ( sources influxql . Sources , t influxql . TimeRange ) query . ShardGroup
}
2017-08-23 20:54:07 +00:00
func ( m * ShardMapper ) MapShards ( sources influxql . Sources , t influxql . TimeRange , opt query . SelectOptions ) ( query . ShardGroup , error ) {
2017-08-22 18:18:41 +00:00
shards := m . MapShardsFn ( sources , t )
return shards , nil
}
type ShardGroup struct {
2017-10-11 14:08:31 +00:00
CreateIteratorFn func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error )
2017-08-22 18:18:41 +00:00
Fields map [ string ] influxql . DataType
Dimensions [ ] string
}
2017-10-11 14:08:31 +00:00
func ( sh * ShardGroup ) CreateIterator ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
return sh . CreateIteratorFn ( ctx , m , opt )
2017-08-22 18:18:41 +00:00
}
2017-08-24 16:27:29 +00:00
func ( sh * ShardGroup ) IteratorCost ( m * influxql . Measurement , opt query . IteratorOptions ) ( query . IteratorCost , error ) {
return query . IteratorCost { } , nil
}
2017-08-22 18:18:41 +00:00
func ( sh * ShardGroup ) FieldDimensions ( m * influxql . Measurement ) ( fields map [ string ] influxql . DataType , dimensions map [ string ] struct { } , err error ) {
fields = make ( map [ string ] influxql . DataType )
dimensions = make ( map [ string ] struct { } )
for f , typ := range sh . Fields {
fields [ f ] = typ
}
for _ , d := range sh . Dimensions {
dimensions [ d ] = struct { } { }
}
return fields , dimensions , nil
}
func ( sh * ShardGroup ) MapType ( m * influxql . Measurement , field string ) influxql . DataType {
if typ , ok := sh . Fields [ field ] ; ok {
return typ
}
for _ , d := range sh . Dimensions {
if d == field {
return influxql . Tag
2016-03-09 16:36:18 +00:00
}
}
2017-08-22 18:18:41 +00:00
return influxql . Unknown
}
func ( * ShardGroup ) Close ( ) error {
return nil
2016-03-09 16:36:18 +00:00
}
2016-04-14 17:08:41 +00:00
func BenchmarkSelect_Raw_1K ( b * testing . B ) { benchmarkSelectRaw ( b , 1000 ) }
func BenchmarkSelect_Raw_100K ( b * testing . B ) { benchmarkSelectRaw ( b , 1000000 ) }
func benchmarkSelectRaw ( b * testing . B , pointN int ) {
benchmarkSelect ( b , MustParseSelectStatement ( ` SELECT fval FROM cpu ` ) , NewRawBenchmarkIteratorCreator ( pointN ) )
}
2017-08-25 04:20:58 +00:00
func benchmarkSelect ( b * testing . B , stmt * influxql . SelectStatement , shardMapper query . ShardMapper ) {
2016-04-14 17:08:41 +00:00
b . ReportAllocs ( )
for i := 0 ; i < b . N ; i ++ {
2018-03-01 20:12:22 +00:00
cur , err := query . Select ( context . Background ( ) , stmt , shardMapper , query . SelectOptions { } )
2017-08-25 04:20:58 +00:00
if err != nil {
b . Fatal ( err )
}
2018-03-01 20:12:22 +00:00
query . DrainCursor ( cur )
2016-04-14 17:08:41 +00:00
}
}
// NewRawBenchmarkIteratorCreator returns a new mock iterator creator with generated fields.
2017-08-25 04:20:58 +00:00
func NewRawBenchmarkIteratorCreator ( pointN int ) query . ShardMapper {
return & ShardMapper {
MapShardsFn : func ( sources influxql . Sources , t influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"fval" : influxql . Float ,
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-25 04:20:58 +00:00
if opt . Expr != nil {
panic ( "unexpected expression" )
}
2016-04-14 17:08:41 +00:00
2017-08-25 04:20:58 +00:00
p := query . FloatPoint {
Name : "cpu" ,
Aux : make ( [ ] interface { } , len ( opt . Aux ) ) ,
}
2016-04-14 17:08:41 +00:00
2017-08-25 04:20:58 +00:00
for i := range opt . Aux {
switch opt . Aux [ i ] . Val {
case "fval" :
p . Aux [ i ] = float64 ( 100 )
default :
panic ( "unknown iterator expr: " + opt . Expr . String ( ) )
}
}
2016-04-14 17:08:41 +00:00
2017-08-25 04:20:58 +00:00
return & FloatPointGenerator { N : pointN , Fn : func ( i int ) * query . FloatPoint {
p . Time = int64 ( time . Duration ( i ) * ( 10 * time . Second ) )
return & p
} } , nil
} ,
}
} ,
2016-04-14 17:08:41 +00:00
}
}
2016-06-03 03:03:57 +00:00
func benchmarkSelectDedupe ( b * testing . B , seriesN , pointsPerSeries int ) {
stmt := MustParseSelectStatement ( ` SELECT sval::string FROM cpu ` )
stmt . Dedupe = true
2017-08-25 04:20:58 +00:00
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , t influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"sval" : influxql . String ,
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-25 04:20:58 +00:00
if opt . Expr != nil {
panic ( "unexpected expression" )
}
2016-06-03 03:03:57 +00:00
2017-08-25 04:20:58 +00:00
p := query . FloatPoint {
Name : "tags" ,
Aux : [ ] interface { } { nil } ,
}
2016-06-03 03:03:57 +00:00
2017-08-25 04:20:58 +00:00
return & FloatPointGenerator { N : seriesN * pointsPerSeries , Fn : func ( i int ) * query . FloatPoint {
p . Aux [ 0 ] = fmt . Sprintf ( "server%d" , i % seriesN )
return & p
} } , nil
} ,
}
} ,
2016-06-03 03:03:57 +00:00
}
b . ResetTimer ( )
2017-08-25 04:20:58 +00:00
benchmarkSelect ( b , stmt , & shardMapper )
2016-06-03 03:03:57 +00:00
}
func BenchmarkSelect_Dedupe_1K ( b * testing . B ) { benchmarkSelectDedupe ( b , 1000 , 100 ) }
Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.
This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.
These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.
It will then sort the final result to ensure the correct ordering of the
selected points.
When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:
SELECT top(value, host, 2) FROM cpu
Essentially becomes this query:
SELECT top(value, 2), host FROM (
SELECT max(value) FROM cpu GROUP BY host
)
This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-16 17:37:39 +00:00
func benchmarkSelectTop ( b * testing . B , seriesN , pointsPerSeries int ) {
stmt := MustParseSelectStatement ( ` SELECT top(sval, 10) FROM cpu ` )
2017-08-25 04:20:58 +00:00
shardMapper := ShardMapper {
MapShardsFn : func ( sources influxql . Sources , t influxql . TimeRange ) query . ShardGroup {
return & ShardGroup {
Fields : map [ string ] influxql . DataType {
"sval" : influxql . Float ,
} ,
2017-10-11 14:08:31 +00:00
CreateIteratorFn : func ( ctx context . Context , m * influxql . Measurement , opt query . IteratorOptions ) ( query . Iterator , error ) {
2017-08-25 04:20:58 +00:00
if m . Name != "cpu" {
b . Fatalf ( "unexpected source: %s" , m . Name )
}
if ! reflect . DeepEqual ( opt . Expr , MustParseExpr ( ` sval ` ) ) {
b . Fatalf ( "unexpected expr: %s" , spew . Sdump ( opt . Expr ) )
}
Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.
This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.
These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.
It will then sort the final result to ensure the correct ordering of the
selected points.
When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:
SELECT top(value, host, 2) FROM cpu
Essentially becomes this query:
SELECT top(value, 2), host FROM (
SELECT max(value) FROM cpu GROUP BY host
)
This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-16 17:37:39 +00:00
2017-08-25 04:20:58 +00:00
p := query . FloatPoint {
Name : "cpu" ,
}
Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.
This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.
These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.
It will then sort the final result to ensure the correct ordering of the
selected points.
When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:
SELECT top(value, host, 2) FROM cpu
Essentially becomes this query:
SELECT top(value, 2), host FROM (
SELECT max(value) FROM cpu GROUP BY host
)
This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-16 17:37:39 +00:00
2017-08-25 04:20:58 +00:00
return & FloatPointGenerator { N : seriesN * pointsPerSeries , Fn : func ( i int ) * query . FloatPoint {
p . Value = float64 ( rand . Int63 ( ) )
p . Time = int64 ( time . Duration ( i ) * ( 10 * time . Second ) )
return & p
} } , nil
} ,
}
} ,
Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.
This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.
These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.
It will then sort the final result to ensure the correct ordering of the
selected points.
When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:
SELECT top(value, host, 2) FROM cpu
Essentially becomes this query:
SELECT top(value, 2), host FROM (
SELECT max(value) FROM cpu GROUP BY host
)
This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-16 17:37:39 +00:00
}
b . ResetTimer ( )
2017-08-25 04:20:58 +00:00
benchmarkSelect ( b , stmt , & shardMapper )
Optimize top() and bottom() using an incremental aggregator
The previous version of `top()` and `bottom()` would gather all of the
points to use in a slice, filter them (if necessary), then use a
slightly modified heap sort to retrieve the top or bottom values.
This performed horrendously from the standpoint of memory. Since it
consumed so much memory and spent so much time in allocations (along
with sorting a potentially very large slice), this affected speed too.
These calls have now been modified so they keep the top or bottom points
in a min or max heap. For `top()`, a new point will read the minimum
value from the heap. If the new point is greater than the minimum point,
it will replace the minimum point and fix the heap with the new value.
If the new point is smaller, it discards that point. For `bottom()`, the
process is the opposite.
It will then sort the final result to ensure the correct ordering of the
selected points.
When `top()` or `bottom()` contain a tag to select, they have now been
modified so this query:
SELECT top(value, host, 2) FROM cpu
Essentially becomes this query:
SELECT top(value, 2), host FROM (
SELECT max(value) FROM cpu GROUP BY host
)
This should drastically increase the performance of all `top()` and
`bottom()` queries.
2017-05-16 17:37:39 +00:00
}
func BenchmarkSelect_Top_1K ( b * testing . B ) { benchmarkSelectTop ( b , 1000 , 1000 ) }
2018-03-01 20:12:22 +00:00
// ReadCursor reads a Cursor into an array of points.
func ReadCursor ( cur query . Cursor ) ( [ ] query . Row , error ) {
defer cur . Close ( )
var rows [ ] query . Row
for {
var row query . Row
if ! cur . Scan ( & row ) {
if err := cur . Err ( ) ; err != nil {
return nil , err
}
return rows , nil
}
rows = append ( rows , row )
}
}