Add filtering to flux range function when not pushed down

pull/10616/head
adamperlin 2018-07-16 20:26:27 -07:00
parent d17beb5b47
commit 5bb0cae73f
70 changed files with 925 additions and 160 deletions

View File

@ -35,7 +35,7 @@ func (b Bounds) Contains(t Time) bool {
}
func (b Bounds) Overlaps(o Bounds) bool {
return b.Contains(o.Start) || b.Contains(o.Stop)
return b.Contains(o.Start) || (b.Contains(o.Stop) && o.Stop > b.Start) || o.Contains(b.Start)
}
func (b Bounds) Equal(o Bounds) bool {

View File

@ -0,0 +1,108 @@
package execute_test
import (
"testing"
"github.com/influxdata/platform/query/execute"
)
// Written to verify symmetrical behavior of execute.(Bounds).Overlaps
// Given two execute.Bounds a and b, if a.Overlaps(b) then b.Overlaps(a).
// Cases:
// given two ranges [a1, a2), [b1, b2)
// a1 <= b1 <= a2 <= b2 -> true
// b1 <= a1 <= b2 <= a2 -> true
// a1 <= b1 <= b2 <= a2 -> true
// b2 <= a1 <= a2 <= b2 -> true
// a1 <= a2 <= b1 <= b2 -> false
// b1 <= b2 <= a1 <= a2 -> false
func TestBounds_Overlaps(t *testing.T) {
tests := []struct {
name string
a, b execute.Bounds
want bool
}{
{
name: "edge overlap",
a: execute.Bounds{
Start: execute.Time(0),
Stop: execute.Time(10),
},
b: execute.Bounds{
Start: execute.Time(10),
Stop: execute.Time(20),
},
want: false,
},
{
name: "edge overlap sym",
a: execute.Bounds{
Start: execute.Time(10),
Stop: execute.Time(20),
},
b: execute.Bounds{
Start: execute.Time(0),
Stop: execute.Time(10),
},
want: false,
},
{
name: "single overlap",
a: execute.Bounds{
Start: execute.Time(0),
Stop: execute.Time(10),
},
b: execute.Bounds{
Start: execute.Time(5),
Stop: execute.Time(15),
},
want: true,
},
{
name: "no overlap sym",
a: execute.Bounds{
Start: execute.Time(0),
Stop: execute.Time(10),
},
b: execute.Bounds{
Start: execute.Time(5),
Stop: execute.Time(15),
},
want: true,
},
{
name: "double overlap (bounds contained)",
a: execute.Bounds{
Start: execute.Time(10),
Stop: execute.Time(20),
},
b: execute.Bounds{
Start: execute.Time(14),
Stop: execute.Time(15),
},
want: true,
},
{
name: "double overlap (bounds contained) sym",
a: execute.Bounds{
Start: execute.Time(14),
Stop: execute.Time(15),
},
b: execute.Bounds{
Start: execute.Time(10),
Stop: execute.Time(20),
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.a.Overlaps(tt.b); got != tt.want {
t.Errorf("Bounds.Overlaps() = %v, want %v", got, tt.want)
}
})
}
}

View File

@ -14,6 +14,7 @@ func ProcessTestHelper(
t *testing.T,
data []query.Table,
want []*Table,
wantErr error,
create func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation,
) {
t.Helper()
@ -27,7 +28,13 @@ func ProcessTestHelper(
parentID := RandomDatasetID()
for _, b := range data {
if err := tx.Process(parentID, b); err != nil {
t.Fatal(err)
if wantErr != nil && wantErr.Error() != err.Error() {
t.Fatalf("unexpected error -want/+got\n%s", cmp.Diff(err.Error(), wantErr.Error()))
} else if wantErr == nil {
t.Fatalf("expected no error, got %s", err.Error())
}
} else if wantErr != nil {
t.Fatalf("expected error %s, got none", err.Error())
}
}

View File

@ -37,6 +37,9 @@ func TestCount_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{

View File

@ -390,6 +390,7 @@ func TestCovariance_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewCovarianceTransformation(d, c, tc.spec)
},

View File

@ -223,6 +223,7 @@ func TestCumulativeSum_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewCumulativeSumTransformation(d, c, tc.spec)
},

View File

@ -418,6 +418,7 @@ func TestDerivative_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewDerivativeTransformation(d, c, tc.spec)
},

View File

@ -363,6 +363,7 @@ func TestDifference_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewDifferenceTransformation(d, c, tc.spec)
},

View File

@ -67,6 +67,9 @@ func TestFilter_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -154,6 +157,9 @@ func TestFilter_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -226,6 +232,9 @@ func TestFilter_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -298,6 +307,9 @@ func TestFilter_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -370,6 +382,9 @@ func TestFilter_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -714,6 +729,7 @@ func TestFilter_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
f, err := functions.NewFilterTransformation(d, c, tc.spec)
if err != nil {

View File

@ -54,6 +54,9 @@ func TestFromCSV_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{

View File

@ -74,6 +74,9 @@ func TestFrom_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{

View File

@ -304,6 +304,7 @@ func TestGroup_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewGroupTransformation(d, c, tc.spec)
},

View File

@ -185,6 +185,7 @@ func TestIntegral_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewIntegralTransformation(d, c, tc.spec)
},

View File

@ -43,6 +43,9 @@ join(tables:{a:a,b:b}, on:["host"], fn: (t) => t.a["_value"] + t.b["_value"])`,
Stop: query.Time{
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -61,6 +64,9 @@ join(tables:{a:a,b:b}, on:["host"], fn: (t) => t.a["_value"] + t.b["_value"])`,
Stop: query.Time{
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -128,6 +134,9 @@ join(tables:{a:a,b:b}, on:["host"], fn: (t) => t.a["_value"] + t.b["_value"])`,
Stop: query.Time{
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -146,6 +155,9 @@ join(tables:{a:a,b:b}, on:["host"], fn: (t) => t.a["_value"] + t.b["_value"])`,
Stop: query.Time{
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{

View File

@ -138,6 +138,7 @@ func TestKeys_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewKeysTransformation(d, c, tc.spec)
},

View File

@ -178,6 +178,7 @@ func TestLimit_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewLimitTransformation(d, c, tc.spec)
},

View File

@ -691,6 +691,7 @@ func TestMap_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
f, err := functions.NewMapTransformation(d, c, tc.spec)
if err != nil {

View File

@ -7,13 +7,17 @@ import (
"github.com/influxdata/platform/query/execute"
"github.com/influxdata/platform/query/plan"
"github.com/influxdata/platform/query/semantic"
"github.com/influxdata/platform/query/values"
)
const RangeKind = "range"
type RangeOpSpec struct {
Start query.Time `json:"start"`
Stop query.Time `json:"stop"`
Start query.Time `json:"start"`
Stop query.Time `json:"stop"`
TimeCol string `json:"time_col"`
StartCol string `json:"start_col"`
StopCol string `json:"stop_col"`
}
var rangeSignature = query.DefaultFunctionSignature()
@ -21,6 +25,7 @@ var rangeSignature = query.DefaultFunctionSignature()
func init() {
rangeSignature.Params["start"] = semantic.Time
rangeSignature.Params["stop"] = semantic.Time
rangeSignature.Params["column"] = semantic.String
query.RegisterFunction(RangeKind, createRangeOpSpec, rangeSignature)
query.RegisterOpSpec(RangeKind, newRangeOp)
@ -50,6 +55,30 @@ func createRangeOpSpec(args query.Arguments, a *query.Administration) (query.Ope
spec.Stop.IsRelative = true
}
if col, ok, err := args.GetString("timeCol"); err != nil {
return nil, err
} else if ok {
spec.TimeCol = col
} else {
spec.TimeCol = execute.DefaultTimeColLabel
}
if label, ok, err := args.GetString("startCol"); err != nil {
return nil, err
} else if ok {
spec.StartCol = label
} else {
spec.StartCol = execute.DefaultStartColLabel
}
if label, ok, err := args.GetString("stopCol"); err != nil {
return nil, err
} else if ok {
spec.StopCol = label
} else {
spec.StopCol = execute.DefaultStopColLabel
}
return spec, nil
}
@ -62,19 +91,31 @@ func (s *RangeOpSpec) Kind() query.OperationKind {
}
type RangeProcedureSpec struct {
Bounds plan.BoundsSpec
Bounds plan.BoundsSpec
TimeCol string
StartCol string
StopCol string
}
func newRangeProcedure(qs query.OperationSpec, pa plan.Administration) (plan.ProcedureSpec, error) {
spec, ok := qs.(*RangeOpSpec)
if !ok {
return nil, fmt.Errorf("invalid spec type %T", qs)
}
if spec.TimeCol == "" {
spec.TimeCol = execute.DefaultTimeColLabel
}
return &RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Start: spec.Start,
Stop: spec.Stop,
},
TimeCol: spec.TimeCol,
StartCol: spec.StartCol,
StopCol: spec.StopCol,
}, nil
}
@ -91,6 +132,9 @@ func (s *RangeProcedureSpec) PushDownRules() []plan.PushDownRule {
return []plan.PushDownRule{{
Root: FromKind,
Through: []plan.ProcedureKind{GroupKind, LimitKind, FilterKind},
Match: func(spec plan.ProcedureSpec) bool {
return s.TimeCol == "_time"
},
}}
}
func (s *RangeProcedureSpec) PushDown(root *plan.Procedure, dup func() *plan.Procedure) {
@ -121,7 +165,22 @@ func createRangeTransformation(id execute.DatasetID, mode execute.AccumulationMo
}
cache := execute.NewTableBuilderCache(a.Allocator())
d := execute.NewDataset(id, mode, cache)
t, err := NewRangeTransformation(d, cache, s)
// Resolve range transformation bounds against current execution now value if they're relative
start := a.ResolveTime(s.Bounds.Start)
stop := a.ResolveTime(s.Bounds.Stop)
// Range behavior is invalid if start > stop
if start > stop {
return nil, nil, fmt.Errorf("range error: start bound greater than stop")
}
absoluteBounds := execute.Bounds{
Start: start,
Stop: stop,
}
t, err := NewRangeTransformation(d, cache, s, absoluteBounds)
if err != nil {
return nil, nil, err
}
@ -129,19 +188,22 @@ func createRangeTransformation(id execute.DatasetID, mode execute.AccumulationMo
}
type rangeTransformation struct {
d execute.Dataset
cache execute.TableBuilderCache
Start query.Time
Stop query.Time
d execute.Dataset
cache execute.TableBuilderCache
bounds execute.Bounds
timeCol string
startCol string
stopCol string
}
func NewRangeTransformation(d execute.Dataset, cache execute.TableBuilderCache, spec *RangeProcedureSpec) (*rangeTransformation, error) {
func NewRangeTransformation(d execute.Dataset, cache execute.TableBuilderCache, spec *RangeProcedureSpec, absolute execute.Bounds) (*rangeTransformation, error) {
return &rangeTransformation{
d: d,
cache: cache,
Start: spec.Bounds.Start,
Stop: spec.Bounds.Stop,
d: d,
cache: cache,
bounds: absolute,
timeCol: spec.TimeCol,
startCol: spec.StartCol,
stopCol: spec.StopCol,
}, nil
}
@ -150,18 +212,143 @@ func (t *rangeTransformation) RetractTable(id execute.DatasetID, key query.Group
}
func (t *rangeTransformation) Process(id execute.DatasetID, tbl query.Table) error {
// Determine index of start and stop columns in group key
startColIdx := execute.ColIdx(t.startCol, tbl.Cols())
stopColIdx := execute.ColIdx(t.stopCol, tbl.Cols())
// Determine index of start and stop columns in table
startKeyColIdx := execute.ColIdx(t.startCol, tbl.Key().Cols())
stopKeyColIdx := execute.ColIdx(t.stopCol, tbl.Key().Cols())
builder, created := t.cache.TableBuilder(tbl.Key())
if !created {
return fmt.Errorf("range found duplicate table with key: %v", tbl.Key())
}
execute.AddTableCols(tbl, builder)
cols := make([]int, len(tbl.Cols()))
for i := range cols {
cols[i] = i
}
execute.AppendTable(tbl, builder, cols)
return nil
execute.AddTableCols(tbl, builder)
timeIdx := execute.ColIdx(t.timeCol, tbl.Cols())
if timeIdx < 0 {
return fmt.Errorf("range error: supplied time column %s doesn't exist", t.timeCol)
}
if builder.Cols()[timeIdx].Type != query.TTime {
return fmt.Errorf("range error: provided column %s is not of type time", t.timeCol)
}
forwardTable := false
if startKeyColIdx > 0 && stopKeyColIdx > 0 {
// Check group key for start and stop vaues.
keyStart := tbl.Key().Value(startKeyColIdx).Time()
keyStop := tbl.Key().Value(stopKeyColIdx).Time()
keyBounds := execute.Bounds{
Start: keyStart,
Stop: keyStop,
}
// If there is no overlap between the bounds in the group key and the bounds in the range transformation,
// no further processing is needed.
if !t.bounds.Overlaps(keyBounds) {
return nil
}
// If [start, stop) (where start <= stop) from the group key is contained in the
// range transformation bounds [keyStart, keyStop], we can skip the whole table.
// Still want to skip if start >= keyStart and t.bounds.Stop == keyStop
forwardTable = t.bounds.Contains(keyStart) && (t.bounds.Contains(keyStop) || t.bounds.Stop == keyStop)
}
if forwardTable {
cols := make([]int, len(tbl.Cols()))
for i := range cols {
cols[i] = i
}
execute.AppendTable(tbl, builder, cols)
return nil
}
// If the start and/or stop columns don't exist,
// They must be added to the table
startAdded, stopAdded := false, false
if startColIdx < 0 {
startColIdx = builder.NCols()
c := query.ColMeta{
Label: t.startCol,
Type: query.TTime,
}
builder.AddCol(c)
startAdded = true
}
if stopColIdx < 0 {
stopColIdx = builder.NCols()
c := query.ColMeta{
Label: t.stopCol,
Type: query.TTime,
}
builder.AddCol(c)
stopAdded = true
}
err := tbl.Do(func(cr query.ColReader) error {
l := cr.Len()
for i := 0; i < l; i++ {
tVal := cr.Times(timeIdx)[i]
if !t.bounds.Contains(tVal) {
continue
}
for j, c := range builder.Cols() {
switch c.Label {
case t.startCol:
var start values.Time
// If we just inserted a start column with no values populated
if startAdded {
start = t.bounds.Start
} else {
start = cr.Times(j)[i]
}
if start < t.bounds.Start {
start = t.bounds.Start
}
builder.AppendTime(j, start)
case t.stopCol:
var stop values.Time
// If we just inserted a stop column with no values populated
if stopAdded {
stop = t.bounds.Stop
} else {
stop = cr.Times(j)[i]
}
if stop > t.bounds.Stop {
stop = t.bounds.Stop
}
builder.AppendTime(j, stop)
default:
switch c.Type {
case query.TBool:
builder.AppendBool(j, cr.Bools(j)[i])
case query.TInt:
builder.AppendInt(j, cr.Ints(j)[i])
case query.TUInt:
builder.AppendUInt(j, cr.UInts(j)[i])
case query.TFloat:
builder.AppendFloat(j, cr.Floats(j)[i])
case query.TString:
builder.AppendString(j, cr.Strings(j)[i])
case query.TTime:
builder.AppendTime(j, cr.Times(j)[i])
default:
execute.PanicUnknownType(c.Type)
}
}
}
}
return nil
})
return err
}
func (t *rangeTransformation) UpdateWatermark(id execute.DatasetID, mark execute.Time) error {

View File

@ -4,8 +4,13 @@ import (
"testing"
"time"
"github.com/influxdata/platform/query/semantic"
"github.com/influxdata/platform/query/values"
"github.com/pkg/errors"
"github.com/influxdata/platform/query"
"github.com/influxdata/platform/query/execute"
"github.com/influxdata/platform/query/execute/executetest"
"github.com/influxdata/platform/query/functions"
"github.com/influxdata/platform/query/plan"
"github.com/influxdata/platform/query/plan/plantest"
@ -36,6 +41,9 @@ func TestRange_NewQuery(t *testing.T) {
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
},
{
@ -51,6 +59,46 @@ func TestRange_NewQuery(t *testing.T) {
},
},
},
{
Name: "from csv with range",
Raw: `fromCSV(csv: "1,2") |> range(start:-4h, stop:-2h, timeCol: "_start") |> sum()`,
Want: &query.Spec{
Operations: []*query.Operation{
{
ID: "fromCSV0",
Spec: &functions.FromCSVOpSpec{
CSV: "1,2",
},
},
{
ID: "range1",
Spec: &functions.RangeOpSpec{
Start: query.Time{
Relative: -4 * time.Hour,
IsRelative: true,
},
Stop: query.Time{
Relative: -2 * time.Hour,
IsRelative: true,
},
TimeCol: "_start",
StartCol: "_start",
StopCol: "_stop",
},
},
{
ID: "sum2",
Spec: &functions.SumOpSpec{
AggregateConfig: execute.DefaultAggregateConfig,
},
},
},
Edges: []query.Edge{
{Parent: "fromCSV0", Child: "range1"},
{Parent: "range1", Child: "sum2"},
},
},
},
}
for _, tc := range tests {
tc := tc
@ -99,6 +147,307 @@ func TestRange_PushDown(t *testing.T) {
plantest.PhysicalPlan_PushDown_TestHelper(t, spec, root, false, want)
}
func TestRange_Process(t *testing.T) {
testCases := []struct {
name string
spec *functions.RangeProcedureSpec
data []query.Table
want []*executetest.Table
groupKey func() query.GroupKey
now values.Time
wantErr error
}{
{
name: "from csv",
spec: &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Start: query.Time{
IsRelative: true,
Relative: -5 * time.Minute,
},
Stop: query.Time{
IsRelative: true,
Relative: -2 * time.Minute,
},
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
data: []query.Table{&executetest.Table{
ColMeta: []query.ColMeta{
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
Data: [][]interface{}{
{execute.Time(time.Minute.Nanoseconds()), 10.0},
{execute.Time(2 * time.Minute.Nanoseconds()), 5.0},
{execute.Time(3 * time.Minute.Nanoseconds()), 9.0},
{execute.Time(4 * time.Minute.Nanoseconds()), 4.0},
{execute.Time(5 * time.Minute.Nanoseconds()), 6.0},
{execute.Time(6 * time.Minute.Nanoseconds()), 8.0},
{execute.Time(7 * time.Minute.Nanoseconds()), 1.0},
},
}},
want: []*executetest.Table{{
ColMeta: []query.ColMeta{
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
{Label: "_start", Type: query.TTime},
{Label: "_stop", Type: query.TTime},
},
Data: [][]interface{}{
{execute.Time(2 * time.Minute.Nanoseconds()), 5.0, execute.Time(2 * time.Minute.Nanoseconds()), execute.Time(5 * time.Minute.Nanoseconds())},
{execute.Time(3 * time.Minute.Nanoseconds()), 9.0, execute.Time(2 * time.Minute.Nanoseconds()), execute.Time(5 * time.Minute.Nanoseconds())},
{execute.Time(4 * time.Minute.Nanoseconds()), 4.0, execute.Time(2 * time.Minute.Nanoseconds()), execute.Time(5 * time.Minute.Nanoseconds())},
},
}},
now: values.Time(7 * time.Minute.Nanoseconds()),
},
{
name: "invalid column",
spec: &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Start: query.Time{
IsRelative: true,
Relative: -5 * time.Minute,
},
Stop: query.Time{
IsRelative: true,
Relative: -2 * time.Minute,
},
},
TimeCol: "_value",
StartCol: "_start",
StopCol: "_stop",
},
data: []query.Table{&executetest.Table{
ColMeta: []query.ColMeta{
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
Data: [][]interface{}{
{execute.Time(time.Minute.Nanoseconds()), 10.0},
{execute.Time(3 * time.Minute.Nanoseconds()), 9.0},
{execute.Time(7 * time.Minute.Nanoseconds()), 1.0},
{execute.Time(2 * time.Minute.Nanoseconds()), 5.0},
{execute.Time(4 * time.Minute.Nanoseconds()), 4.0},
{execute.Time(6 * time.Minute.Nanoseconds()), 8.0},
{execute.Time(5 * time.Minute.Nanoseconds()), 6.0},
},
}},
want: []*executetest.Table{{
ColMeta: []query.ColMeta{
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
Data: [][]interface{}(nil),
}},
wantErr: errors.New("range error: provided column _value is not of type time"),
now: values.Time(7 * time.Minute.Nanoseconds()),
},
{
name: "specified column",
spec: &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Start: query.Time{
IsRelative: true,
Relative: -2 * time.Minute,
},
Stop: query.Time{
IsRelative: true,
},
},
TimeCol: "_start",
StartCol: "_start",
StopCol: "_stop",
},
data: []query.Table{&executetest.Table{
ColMeta: []query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
Data: [][]interface{}{
{execute.Time(0), execute.Time(time.Minute.Nanoseconds()), 10.0},
{execute.Time(time.Minute.Nanoseconds()), execute.Time(3 * time.Minute.Nanoseconds()), 9.0},
{execute.Time(2 * time.Minute.Nanoseconds()), execute.Time(7 * time.Minute.Nanoseconds()), 1.0},
{execute.Time(3 * time.Minute.Nanoseconds()), execute.Time(4 * time.Minute.Nanoseconds()), 4.0},
},
}},
want: []*executetest.Table{{
ColMeta: []query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
{Label: "_stop", Type: query.TTime},
},
Data: [][]interface{}{
{execute.Time(time.Minute.Nanoseconds()), execute.Time(3 * time.Minute.Nanoseconds()), 9.0, execute.Time(3 * time.Minute.Nanoseconds())},
{execute.Time(2 * time.Minute.Nanoseconds()), execute.Time(7 * time.Minute.Nanoseconds()), 1.0, execute.Time(3 * time.Minute.Nanoseconds())},
},
}},
now: values.Time(3 * time.Minute.Nanoseconds()),
},
{
name: "group key no overlap",
spec: &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Start: query.Time{
IsRelative: true,
Relative: -2 * time.Minute,
},
Stop: query.Time{
IsRelative: true,
},
},
TimeCol: "_start",
StartCol: "_start",
StopCol: "_stop",
},
data: []query.Table{&executetest.Table{
ColMeta: []query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_stop", Type: query.TTime},
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
KeyCols: []string{"_start", "_stop"},
KeyValues: []interface{}{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds())},
Data: [][]interface{}{
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(11 * time.Minute.Nanoseconds()), 10.0},
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(12 * time.Minute.Nanoseconds()), 9.0},
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(13 * time.Minute.Nanoseconds()), 1.0},
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(14 * time.Minute.Nanoseconds()), 4.0},
},
}},
want: []*executetest.Table{{
ColMeta: []query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_stop", Type: query.TTime},
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
KeyCols: []string{"_start", "_stop"},
KeyValues: []interface{}{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds())},
Data: [][]interface{}(nil),
}},
now: values.Time(3 * time.Minute.Nanoseconds()),
},
{
name: "group key overlap",
spec: &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Start: query.Time{
Absolute: time.Unix(12*time.Minute.Nanoseconds(), 0),
},
Stop: query.Time{
Absolute: time.Unix(14*time.Minute.Nanoseconds(), 0),
},
},
TimeCol: "_time",
StartCol: "_start",
StopCol: "_stop",
},
data: []query.Table{&executetest.Table{
ColMeta: []query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_stop", Type: query.TTime},
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
KeyCols: []string{"_start", "_stop"},
KeyValues: []interface{}{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds())},
Data: [][]interface{}{
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(11 * time.Minute.Nanoseconds()), 11.0},
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(12 * time.Minute.Nanoseconds()), 9.0},
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(13 * time.Minute.Nanoseconds()), 1.0},
{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds()), execute.Time(14 * time.Minute.Nanoseconds()), 4.0},
},
}},
want: []*executetest.Table{{
ColMeta: []query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_stop", Type: query.TTime},
{Label: "_time", Type: query.TTime},
{Label: "_value", Type: query.TFloat},
},
KeyCols: []string{"_start", "_stop"},
KeyValues: []interface{}{execute.Time(10 * time.Minute.Nanoseconds()), execute.Time(20 * time.Minute.Nanoseconds())},
Data: [][]interface{}{
{execute.Time(12 * time.Minute.Nanoseconds()), execute.Time(14 * time.Minute.Nanoseconds()), execute.Time(12 * time.Minute.Nanoseconds()), 9.0},
{execute.Time(12 * time.Minute.Nanoseconds()), execute.Time(14 * time.Minute.Nanoseconds()), execute.Time(13 * time.Minute.Nanoseconds()), 1.0},
},
}},
groupKey: func() query.GroupKey {
t1, err := values.NewValue(values.Time(10*time.Minute.Nanoseconds()), semantic.Time)
if err != nil {
t.Fatal(err)
}
t2, err := values.NewValue(values.Time(20*time.Minute.Nanoseconds()), semantic.Time)
if err != nil {
t.Fatal(err)
}
vs := []values.Value{t1, t2}
return execute.NewGroupKey(
[]query.ColMeta{
{Label: "_start", Type: query.TTime},
{Label: "_stop", Type: query.TTime},
},
vs,
)
},
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
if tc.groupKey != nil && tc.want != nil {
// populate group keys for the test case
for _, table := range tc.data {
tbl, ok := table.(*executetest.Table)
if !ok {
t.Fatal("failed to set group key")
}
tbl.GroupKey = tc.groupKey()
}
for _, table := range tc.want {
table.GroupKey = tc.groupKey()
}
}
executetest.ProcessTestHelper(
t,
tc.data,
tc.want,
tc.wantErr,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
var b execute.Bounds
if tc.spec.Bounds.Start.IsRelative {
b.Start = execute.Time(tc.spec.Bounds.Start.Time(tc.now.Time()).UnixNano())
} else {
b.Start = execute.Time(tc.spec.Bounds.Start.Absolute.Unix())
}
if tc.spec.Bounds.Stop.IsRelative {
b.Stop = execute.Time(tc.spec.Bounds.Stop.Time(tc.now.Time()).UnixNano())
} else {
if tc.spec.Bounds.Stop.Absolute.Unix() == 0 {
tc.spec.Bounds.Stop.Absolute = tc.now.Time()
} else {
b.Stop = execute.Time(tc.spec.Bounds.Stop.Absolute.Unix())
}
}
tr, err := functions.NewRangeTransformation(d, c, tc.spec, b)
if err != nil {
t.Fatal(err)
}
return tr
},
)
})
}
}
func TestRange_PushDown_Duplicate(t *testing.T) {
spec := &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
@ -121,3 +470,19 @@ func TestRange_PushDown_Duplicate(t *testing.T) {
plantest.PhysicalPlan_PushDown_TestHelper(t, spec, root, true, want)
}
func TestRange_PushDown_Match(t *testing.T) {
spec := &functions.RangeProcedureSpec{
Bounds: plan.BoundsSpec{
Stop: query.Now,
},
TimeCol: "_time",
}
matchSpec := new(functions.FromProcedureSpec)
// Should match when range procedure has column `_time`
plantest.PhysicalPlan_PushDown_Match_TestHelper(t, spec, matchSpec, []bool{true})
// Should not match when range procedure column is anything else
spec.TimeCol = "_col"
plantest.PhysicalPlan_PushDown_Match_TestHelper(t, spec, matchSpec, []bool{false})
}

View File

@ -236,6 +236,7 @@ func TestSet_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewSetTransformation(d, c, tc.spec)
},

View File

@ -113,6 +113,7 @@ func TestShift_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewShiftTransformation(d, c, tc.spec)
},

View File

@ -340,6 +340,7 @@ func TestSort_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewSortTransformation(d, c, tc.spec)
},

View File

@ -167,6 +167,7 @@ func TestStateTracking_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
tx, err := functions.NewStateTrackingTransformation(d, c, tc.spec)
if err != nil {

View File

@ -2,12 +2,12 @@
#group,false,false,false,false,false,false,true,true,true,true
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,0.02,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,0.08,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:26Z,0.04,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:36Z,0.16,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:46Z,0.07,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:56Z,0.03,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,0.02,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,0.08,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:26Z,0.04,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:36Z,0.16,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:46Z,0.07,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:56Z,0.03,usage_guest_nice,cpu,cpu-total,host.local

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
2 #group false false false false false false true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement cpu host
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:46Z 0 usage_guest_nice cpu cpu-total host.local
6 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:56Z 0 usage_guest_nice cpu cpu-total host.local
7 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:06Z 0.02 usage_guest_nice cpu cpu-total host.local
8 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:16Z 0.08 usage_guest_nice cpu cpu-total host.local
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:26Z 0.04 usage_guest_nice cpu cpu-total host.local
10 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:36Z 0.16 usage_guest_nice cpu cpu-total host.local
11 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:46Z 0.07 usage_guest_nice cpu cpu-total host.local
12 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:56Z 0.03 usage_guest_nice cpu cpu-total host.local
13

View File

@ -1,3 +1,3 @@
from(db: "test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> difference()

View File

@ -7,4 +7,4 @@
,,96,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,34.982447293755506,used_percent,disk,disk1s1,apfs,host.local,/
,,96,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,34.982447293755506,used_percent,disk,disk1s1,apfs,host.local,/
,,96,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,34.98204153981662,used_percent,disk,disk1s1,apfs,host.local,/
,,96,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,34.982252364543626,used_percent,disk,disk1s1,apfs,host.local,/
,,96,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,34.982252364543626,used_percent,disk,disk1s1,apfs,host.local,/
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string string string
7 96 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 34.982447293755506 used_percent disk disk1s1 apfs host.local /
8 96 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 34.982447293755506 used_percent disk disk1s1 apfs host.local /
9 96 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 34.98204153981662 used_percent disk disk1s1 apfs host.local /
10 96 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 34.982252364543626 used_percent disk disk1s1 apfs host.local /

View File

@ -2,9 +2,9 @@
#group,false,false,false,false,false,false,true,true,true,true,true,true
#default,_result,,,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,device,fstype,host,path
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0.000006692848479872282,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,0.00009788290896750595,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,0,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,-0.0004057539388853115,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0.00021082472700584276,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0.000006692848479872282,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,0.00009788290896750595,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,0,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,-0.0004057539388853115,used_percent,disk,disk1s1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0.00021082472700584276,used_percent,disk,disk1s1,apfs,host.local,/

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string string string
2 #group false false false false false false true true true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement device fstype host path
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 0.000006692848479872282 used_percent disk disk1s1 apfs host.local /
6 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 0.00009788290896750595 used_percent disk disk1s1 apfs host.local /
7 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 0 used_percent disk disk1s1 apfs host.local /
8 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z -0.0004057539388853115 used_percent disk disk1s1 apfs host.local /
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 0.00021082472700584276 used_percent disk disk1s1 apfs host.local /
10

View File

@ -1,3 +1,3 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> difference(nonNegative:true)

View File

@ -2,4 +2,4 @@
#group,false,false,false,false,false,false,true,true,true,true
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1,usage_guest,cpu,cpu-total,host.local
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
2 #group false false false false false false true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement cpu host
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1 usage_guest cpu cpu-total host.local

View File

@ -1,5 +1,5 @@
from(db: "test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._field == "no_exist")
|> difference()

View File

@ -9,4 +9,4 @@
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1,usage_guest,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,4,field1,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,4,field1,cpu,cpu-total,host.local
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 0 usage_guest cpu cpu-total host.local
10 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1 usage_guest cpu cpu-total host.local
11 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 2 usage_guest_nice cpu cpu-total host.local
12 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 4 field1 cpu cpu-total host.local

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: 2018-05-23T13:09:22.885021542Z)
|> range(start: 2018-05-22T19:53:26Z)
|> filter(fn: (r) => r["name"] =~ /.*0/)
|> group(by: ["_measurement"])
|> map(fn: (r) => {_time: r._time, io_time: r._value})

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: 2018-05-23T13:09:22.885021542Z)
|> range(start: 2018-05-22T19:53:26Z)
|> filter(fn: (r) => r["name"] == "disk0")
|> group(by: ["_measurement"])
|> map(fn: (r) => {_time: r._time, io_time: r._value})

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: 2018-05-23T13:09:22.885021542Z)
|> range(start: 2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._measurement == "diskio" and r._field == "io_time")
|> group(by: ["_measurement", "name"])
|> max()

View File

@ -1,3 +1,3 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> group(by: ["_value"])

View File

@ -2,10 +2,10 @@
#group,false,false,false,false,false,true,false,false,false,false
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,68.304576144036,usage_idle,cpu,cpu-total,host1
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,87.88598574821853,usage_idle,cpu,cpu-total,host2
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,89.51118889861233,usage_idle,cpu,cpu-total,host2
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,91.02836436336374,usage_idle,cpu,cpu-total,host2
,,4,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,91.0977744436109,usage_idle,cpu,cpu-total,host1
,,5,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,91.7364670583823,usage_idle,cpu,cpu-total,host1
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,68.304576144036,usage_idle,cpu,cpu-total,host1
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,87.88598574821853,usage_idle,cpu,cpu-total,host2
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,89.51118889861233,usage_idle,cpu,cpu-total,host2
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,91.02836436336374,usage_idle,cpu,cpu-total,host2
,,4,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,91.0977744436109,usage_idle,cpu,cpu-total,host1
,,5,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,91.7364670583823,usage_idle,cpu,cpu-total,host1

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
2 #group false false false false false true false false false false
3 #default _result
4 result table _start _stop _time _value _field _measurement cpu host
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 68.304576144036 usage_idle cpu cpu-total host1
6 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 87.88598574821853 usage_idle cpu cpu-total host2
7 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 89.51118889861233 usage_idle cpu cpu-total host2
8 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 91.02836436336374 usage_idle cpu cpu-total host2
9 4 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 91.0977744436109 usage_idle cpu cpu-total host1
10 5 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 91.7364670583823 usage_idle cpu cpu-total host1
11

View File

@ -1,4 +1,4 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> group(except:["_measurement", "_time", "_value"])
|> max()

View File

@ -2,6 +2,6 @@
#group,false,false,true,true,false,false,true,false,true,true
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,host,name
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,15205755,io_time,diskio2,host.local,disk0
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,648,io_time,diskio2,host.local,disk2
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,15205755,io_time,diskio2,host.local,disk0
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,648,io_time,diskio2,host.local,disk2

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 long string string string string
2 #group false false true true false false true false true true
3 #default _result
4 result table _start _stop _time _value _field _measurement host name
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 15205755 io_time diskio2 host.local disk0
6 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 648 io_time diskio2 host.local disk2
7

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: 2018-05-23T13:09:22.885021542Z)
|> range(start: 2018-05-22T19:53:26Z)
|> group(by: ["name"])
|> group()
|> map(fn: (r) => {_time: r._time, io_time:r._value})

View File

@ -1,4 +1,4 @@
from(db: "test")
|> range(start:2018-05-22T19:53:26Z)
|> increase()
|> range(start:2018-05-22T19:53:26Z)
|> increase()

View File

@ -2,18 +2,18 @@
#group,false,false,false,false,false,false,true,true,true,true
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,1,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,2,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,4,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,4,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,5,usage_guest,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,4,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,12,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:26Z,16,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:36Z,32,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:46Z,39,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:55:00Z,2018-05-22T19:54:56Z,42,usage_guest_nice,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,1,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,2,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,4,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,4,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,5,usage_guest,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:36Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:46Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:53:56Z,2,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:06Z,4,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:16Z,12,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:26Z,16,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:36Z,32,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:46Z,39,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:55:00Z,2018-05-22T19:54:56Z,42,usage_guest_nice,cpu,cpu-total,host.local

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
2 #group false false false false false false true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement cpu host
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:36Z 1 usage_guest cpu cpu-total host.local
6 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:46Z 2 usage_guest cpu cpu-total host.local
7 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:56Z 4 usage_guest cpu cpu-total host.local
8 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:06Z 4 usage_guest cpu cpu-total host.local
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:16Z 5 usage_guest cpu cpu-total host.local
10 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:36Z 2 usage_guest_nice cpu cpu-total host.local
11 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:46Z 2 usage_guest_nice cpu cpu-total host.local
12 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:53:56Z 2 usage_guest_nice cpu cpu-total host.local
13 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:06Z 4 usage_guest_nice cpu cpu-total host.local
14 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:16Z 12 usage_guest_nice cpu cpu-total host.local
15 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:26Z 16 usage_guest_nice cpu cpu-total host.local
16 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:36Z 32 usage_guest_nice cpu cpu-total host.local
17 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:46Z 39 usage_guest_nice cpu cpu-total host.local
18 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:55:00Z 2018-05-22T19:54:56Z 42 usage_guest_nice cpu cpu-total host.local
19

View File

@ -1,5 +1,5 @@
from(db: "test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._measurement == "cpu")
|> group(by: ["_field"])
|> distinct(column: "_field")

View File

@ -1,11 +1,11 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._measurement == "cpu")
|> keys()
|> yield(name:"0")
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._measurement == "cpu")
|> group(by: ["host"])
|> distinct(column: "host")

View File

@ -27,4 +27,4 @@
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,0,usage_iowait,cpu,cpu-total,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0,usage_iowait,cpu,cpu-total,host.local
,,4,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,0,usage_irq,cpu,cpu-total,host.local
,,4,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0,usage_irq,cpu,cpu-total,host.local
,,4,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0,usage_irq,cpu,cpu-total,host.local
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
27 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 0 usage_iowait cpu cpu-total host.local
28 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 0 usage_iowait cpu cpu-total host.local
29 4 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 0 usage_irq cpu cpu-total host.local
30 4 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 0 usage_irq cpu cpu-total host.local

View File

@ -1,5 +1,5 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> group(by: ["_measurement"])
|> distinct(column: "_measurement")
|> group(none:true)

View File

@ -1,3 +1,3 @@
from(db: "test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._value == null)

3
query/functions/testdata/range.flux vendored Normal file
View File

@ -0,0 +1,3 @@
from(db:"test")
|> range(start:2018-05-22T19:53:36Z)

16
query/functions/testdata/range.in.csv vendored Normal file
View File

@ -0,0 +1,16 @@
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string,string
#group,false,false,false,false,false,false,true,true,true,true
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:52:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:50:26Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0,usage_guest,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0,usage_guest_nice,cpu,cpu-total,host.local
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
2 #group false false false false false false true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement cpu host
5 0 2018-05-22T19:52:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:50:26Z 0 usage_guest cpu cpu-total host.local
6 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 0 usage_guest cpu cpu-total host.local
7 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 0 usage_guest cpu cpu-total host.local
8 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 0 usage_guest cpu cpu-total host.local
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 0 usage_guest cpu cpu-total host.local
10 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 0 usage_guest cpu cpu-total host.local
11 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 0 usage_guest_nice cpu cpu-total host.local
12 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 0 usage_guest_nice cpu cpu-total host.local
13 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 0 usage_guest_nice cpu cpu-total host.local
14 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 0 usage_guest_nice cpu cpu-total host.local
15 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 0 usage_guest_nice cpu cpu-total host.local
16 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 0 usage_guest_nice cpu cpu-total host.local

15
query/functions/testdata/range.out.csv vendored Normal file
View File

@ -0,0 +1,15 @@
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string,string
#group,false,false,false,false,false,false,true,true,true,true
#default,_result,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,cpu,host
,,0,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,0,usage_guest,cpu,cpu-total,host.local
,,0,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0,usage_guest,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,0,usage_guest_nice,cpu,cpu-total,host.local
,,1,2018-05-22T19:53:36Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,0,usage_guest_nice,cpu,cpu-total,host.local
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string string
2 #group false false false false false false true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement cpu host
5 0 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 0 usage_guest cpu cpu-total host.local
6 0 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 0 usage_guest cpu cpu-total host.local
7 0 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 0 usage_guest cpu cpu-total host.local
8 0 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 0 usage_guest cpu cpu-total host.local
9 0 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 0 usage_guest cpu cpu-total host.local
10 1 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 0 usage_guest_nice cpu cpu-total host.local
11 1 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 0 usage_guest_nice cpu cpu-total host.local
12 1 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 0 usage_guest_nice cpu cpu-total host.local
13 1 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 0 usage_guest_nice cpu cpu-total host.local
14 1 2018-05-22T19:53:36Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 0 usage_guest_nice cpu cpu-total host.local

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: 2018-05-23T13:09:22.885021542Z)
|> range(start: 2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._measurement == "system" AND r._field == "load1")
|> group(by: ["_measurement"])
|> map(fn: (r) => {_time: r._time, load1:r._value})

View File

@ -1,4 +1,4 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> top(n:3)
|> group(by:["host"])

View File

@ -2,7 +2,7 @@
#group,false,false,false,false,false,false,false,false,true
#default,_result,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,host
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,37.28463649749756,available_percent,mem,host2
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,37.61239051818848,available_percent,mem,host3
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,37.53254413604736,available_percent,mem,host5
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,37.28463649749756,available_percent,mem,host2
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,37.61239051818848,available_percent,mem,host3
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,37.53254413604736,available_percent,mem,host5

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string
2 #group false false false false false false false false true
3 #default _result
4 result table _start _stop _time _value _field _measurement host
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 37.28463649749756 available_percent mem host2
6 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 37.61239051818848 available_percent mem host3
7 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 37.53254413604736 available_percent mem host5
8

View File

@ -1,5 +1,5 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-04-17T00:00:00Z)
|> group(by: ["_measurement"])
|> max(column: "_value")
|> map(fn: (r) => {_time: r._time,max:r._value})

View File

@ -1 +1 @@
select max(f1) from test..m1 where time >= now() - 5m and time < now()
select max(f1) from test..m1 where time >= '2018-04-17T00:00:00Z' and time < now()

View File

@ -1,3 +1,3 @@
from(db:"testdb")
|> range(start: 2018-05-23T13:09:22.885021542Z)
|> sort(cols:["_value"])
|> range(start: 2018-05-22T19:53:26Z)
|> sort(cols:["_value", "_time"])

View File

@ -2,33 +2,33 @@
#group,false,false,false,false,false,false,true,true,true
#default,_result,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,host
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,82.9833984375,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,82.6416015625,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,2.9833984375,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,2.6416015625,used_percent,swap,host1.local
,,162,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.83,load1,system,host.local
,,162,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.7,load1,system,host.local
,,162,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.74,load1,system,host.local
,,162,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.63,load1,system,host.local
,,162,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.91,load1,system,host.local
,,162,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.84,load1,system,host.local
,,163,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.98,load15,system,host.local
,,163,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.97,load15,system,host.local
,,163,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.97,load15,system,host.local
,,163,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.96,load15,system,host.local
,,163,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.98,load15,system,host.local
,,163,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.97,load15,system,host.local
,,164,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.95,load5,system,host.local
,,164,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.92,load5,system,host.local
,,164,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.92,load5,system,host.local
,,164,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.89,load5,system,host.local
,,164,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.94,load5,system,host.local
,,164,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.93,load5,system,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,82.9833984375,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,82.598876953125,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,82.6416015625,used_percent,swap,host.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,2.9833984375,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,2.598876953125,used_percent,swap,host1.local
,,161,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,2.6416015625,used_percent,swap,host1.local
,,162,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.83,load1,system,host.local
,,162,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.7,load1,system,host.local
,,162,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.74,load1,system,host.local
,,162,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.63,load1,system,host.local
,,162,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.91,load1,system,host.local
,,162,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.84,load1,system,host.local
,,163,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.98,load15,system,host.local
,,163,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.97,load15,system,host.local
,,163,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.97,load15,system,host.local
,,163,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.96,load15,system,host.local
,,163,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.98,load15,system,host.local
,,163,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.97,load15,system,host.local
,,164,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.95,load5,system,host.local
,,164,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.92,load5,system,host.local
,,164,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.92,load5,system,host.local
,,164,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.89,load5,system,host.local
,,164,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.94,load5,system,host.local
,,164,2018-05-22T19:53:24.4214704Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.93,load5,system,host.local
1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string
2 #group false false false false false false true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement host
5 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 82.9833984375 used_percent swap host.local
6 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 82.598876953125 used_percent swap host.local
7 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 82.598876953125 used_percent swap host.local
8 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 82.598876953125 used_percent swap host.local
9 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 82.598876953125 used_percent swap host.local
10 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 82.6416015625 used_percent swap host.local
11 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 2.9833984375 used_percent swap host1.local
12 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 2.598876953125 used_percent swap host1.local
13 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 2.598876953125 used_percent swap host1.local
14 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 2.598876953125 used_percent swap host1.local
15 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 2.598876953125 used_percent swap host1.local
16 161 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 2.6416015625 used_percent swap host1.local
17 162 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1.83 load1 system host.local
18 162 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 1.7 load1 system host.local
19 162 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 1.74 load1 system host.local
20 162 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 1.63 load1 system host.local
21 162 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 1.91 load1 system host.local
22 162 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1.84 load1 system host.local
23 163 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1.98 load15 system host.local
24 163 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 1.97 load15 system host.local
25 163 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 1.97 load15 system host.local
26 163 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 1.96 load15 system host.local
27 163 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 1.98 load15 system host.local
28 163 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1.97 load15 system host.local
29 164 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1.95 load5 system host.local
30 164 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 1.92 load5 system host.local
31 164 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 1.92 load5 system host.local
32 164 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 1.89 load5 system host.local
33 164 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 1.94 load5 system host.local
34 164 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:24.4214704Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1.93 load5 system host.local

View File

@ -2,34 +2,34 @@
#group,false,false,false,false,false,false,true,true,true
#default,_result,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,host
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.63,load1,system,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.7,load1,system,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.74,load1,system,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.83,load1,system,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.84,load1,system,host.local
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.91,load1,system,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.96,load15,system,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.97,load15,system,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.97,load15,system,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.97,load15,system,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.98,load15,system,host.local
,,1,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.98,load15,system,host.local
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.89,load5,system,host.local
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.92,load5,system,host.local
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.92,load5,system,host.local
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.93,load5,system,host.local
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.94,load5,system,host.local
,,2,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.95,load5,system,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,2.6416015625,used_percent,swap,host1.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,2.9833984375,used_percent,swap,host1.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,82.6416015625,used_percent,swap,host.local
,,3,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,82.9833984375,used_percent,swap,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.63,load1,system,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.7,load1,system,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.74,load1,system,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.83,load1,system,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.84,load1,system,host.local
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.91,load1,system,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.96,load15,system,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.97,load15,system,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.97,load15,system,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.97,load15,system,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.98,load15,system,host.local
,,1,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.98,load15,system,host.local
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,1.89,load5,system,host.local
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,1.92,load5,system,host.local
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,1.92,load5,system,host.local
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,1.93,load5,system,host.local
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,1.94,load5,system,host.local
,,2,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,1.95,load5,system,host.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,2.598876953125,used_percent,swap,host1.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,2.6416015625,used_percent,swap,host1.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,2.9833984375,used_percent,swap,host1.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,82.598876953125,used_percent,swap,host.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,82.6416015625,used_percent,swap,host.local
,,3,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,82.9833984375,used_percent,swap,host.local

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 double string string string
2 #group false false false false false false true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement host
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 1.63 load1 system host.local
6 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 1.7 load1 system host.local
7 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 1.74 load1 system host.local
8 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1.83 load1 system host.local
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1.84 load1 system host.local
10 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 1.91 load1 system host.local
11 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 1.96 load15 system host.local
12 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 1.97 load15 system host.local
13 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 1.97 load15 system host.local
14 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1.97 load15 system host.local
15 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1.98 load15 system host.local
16 1 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 1.98 load15 system host.local
17 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 1.89 load5 system host.local
18 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 1.92 load5 system host.local
19 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 1.92 load5 system host.local
20 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 1.93 load5 system host.local
21 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 1.94 load5 system host.local
22 2 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 1.95 load5 system host.local
23 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 2.598876953125 used_percent swap host1.local
24 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 2.598876953125 used_percent swap host1.local
25 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 2.598876953125 used_percent swap host1.local
26 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 2.598876953125 used_percent swap host1.local
27 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 2.6416015625 used_percent swap host1.local
28 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 2.9833984375 used_percent swap host1.local
29 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z 82.598876953125 used_percent swap host.local
30 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z 82.598876953125 used_percent swap host.local
31 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 82.598876953125 used_percent swap host.local
32 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z 82.598876953125 used_percent swap host.local
33 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 82.6416015625 used_percent swap host.local
34 3 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z 82.9833984375 used_percent swap host.local
35

View File

@ -1,5 +1,5 @@
n = 1
fieldSelect = "field{n}"
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> filter(fn: (r) => r._field == fieldSelect)

View File

@ -1,3 +1,3 @@
from(db:"test")
|> range(start:-5m)
|> range(start:2018-05-22T19:54:16Z)
|> max()

View File

@ -1,3 +1,3 @@
from(db: "test")
|> range(start:-5m)
|> range(start:2018-05-22T19:53:26Z)
|> sort()

View File

@ -2,10 +2,10 @@
#group,false,false,false,false,false,false,true,true,true,true,true,true
#default,_result,,,,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,device,fstype,host,path
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,13F2,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,2COTDe,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,a,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,b,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,cLnSkNMI,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:24.421470485Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,k9ngm,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:16Z,13F2,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:56Z,2COTDe,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:26Z,a,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:46Z,b,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:54:06Z,cLnSkNMI,used_percent,disk,disk1,apfs,host.local,/
,,0,2018-05-22T19:53:26Z,2018-05-22T19:54:24.421470485Z,2018-05-22T19:53:36Z,k9ngm,used_percent,disk,disk1,apfs,host.local,/

1 #datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 string string string string string string string
2 #group false false false false false false true true true true true true
3 #default _result
4 result table _start _stop _time _value _field _measurement device fstype host path
5 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:16Z 13F2 used_percent disk disk1 apfs host.local /
6 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:56Z 2COTDe used_percent disk disk1 apfs host.local /
7 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:26Z a used_percent disk disk1 apfs host.local /
8 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:46Z b used_percent disk disk1 apfs host.local /
9 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:54:06Z cLnSkNMI used_percent disk disk1 apfs host.local /
10 0 2018-05-22T19:53:24.421470485Z 2018-05-22T19:53:26Z 2018-05-22T19:54:24.421470485Z 2018-05-22T19:53:36Z k9ngm used_percent disk disk1 apfs host.local /
11

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: -5s)
|> range(start:2018-05-22T19:53:26Z)
|> group(by: ["_measurement"])
|> window(every: 1s, ignoreGlobalBounds: true)
|> mean(timeSrc: "_start")

View File

@ -1 +1 @@
select mean(io_time) from testdb..diskio where time >= now() - 5s group by time(1s)
select mean(io_time) from testdb..diskio where time >= '2018-05-22T19:53:26Z' and time < now() group by time(1s)

View File

@ -1,5 +1,5 @@
from(db:"testdb")
|> range(start: -5s)
|> range(start:2018-05-22T19:53:26Z)
|> group(by: ["_measurement"])
|> window(every: 1s, start: 2, ignoreGlobalBounds: true)
|> mean(timeSrc: "_start")

View File

@ -1 +1 @@
select mean(io_time) from testdb..diskio where time >= now() - 5s group by time(1s, 2s)
select mean(io_time) from testdb..diskio where time >= '2018-05-22T19:53:26Z' and time < now() group by time(1s, 2s)

View File

@ -445,6 +445,7 @@ one_table_w_tag,fred=elevendyone _value=4 41
t,
tc.data,
tc.want.Table,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewToHTTPTransformation(d, c, tc.spec)
},

View File

@ -419,6 +419,7 @@ func TestToKafka_Process(t *testing.T) {
t,
tc.data,
tc.want.Table,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewToKafkaTransformation(d, c, tc.spec)
},

View File

@ -140,6 +140,7 @@ func TestUnique_Process(t *testing.T) {
t,
tc.data,
tc.want,
nil,
func(d execute.Dataset, c execute.TableBuilderCache) execute.Transformation {
return functions.NewUniqueTransformation(d, c, tc.spec)
},

View File

@ -59,6 +59,7 @@ func TestLogicalPlanner_Plan(t *testing.T) {
Bounds: plan.BoundsSpec{
Start: query.Time{Relative: -1 * time.Hour},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{
plan.ProcedureIDFromOperationID("0"),
@ -99,6 +100,7 @@ func TestLogicalPlanner_Plan(t *testing.T) {
Bounds: plan.BoundsSpec{
Start: query.Time{Relative: -1 * time.Hour},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{
plan.ProcedureIDFromOperationID("select0"),
@ -127,6 +129,7 @@ func TestLogicalPlanner_Plan(t *testing.T) {
Bounds: plan.BoundsSpec{
Start: query.Time{Relative: -1 * time.Hour},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{
plan.ProcedureIDFromOperationID("select1"),

View File

@ -43,6 +43,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{
plan.ProcedureIDFromOperationID("from"),
@ -187,6 +188,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{
(plan.ProcedureIDFromOperationID("from")),
@ -292,6 +294,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{plan.ProcedureIDFromOperationID("from")},
Children: []plan.ProcedureID{
@ -413,6 +416,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{plan.ProcedureIDFromOperationID("from")},
Children: []plan.ProcedureID{
@ -516,6 +520,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{plan.ProcedureIDFromOperationID("from")},
Children: []plan.ProcedureID{
@ -621,6 +626,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{plan.ProcedureIDFromOperationID("from")},
Children: []plan.ProcedureID{
@ -724,6 +730,7 @@ func TestPhysicalPlanner_Plan(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{plan.ProcedureIDFromOperationID("from")},
Children: []plan.ProcedureID{
@ -938,6 +945,7 @@ func TestPhysicalPlanner_Plan_PushDown_Mixed(t *testing.T) {
Relative: -1 * time.Hour,
},
},
TimeCol: "_time",
},
Parents: []plan.ProcedureID{
(plan.ProcedureIDFromOperationID("from")),