This is the query based on the `net` data from telegraf:
```
import "system"
…import "influxdata/influxdb/v1"
data = from(bucket: "telegraf")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "net")
|> filter(fn: (r) => r._field =~ /^drop_/)
|> filter(fn: (r) => r.host == v.network_host)
last = data |> last() |> v1.fieldsAsCols()
first = data |> first() |> v1.fieldsAsCols()
join(tables: {l: last, f: first}, on: ["host","interface","_measurement"], method: "inner")
|> drop(columns: ["_time_f", "_time_l","_stop_f","_stop_l","_start_f","_start_l"])
|> map(fn: (r) => ({ r with _value: ((r.drop_in_l - r.drop_in_f) + (r.drop_out_l - r.drop_out_f)) }))
|> map(fn: (r) => ({ r with _time: system.time() }))
|> keep(columns: ["_time", "_value", "host", "interface"])
```
`network_host` is a variable defined as:
```
import "influxdata/influxdb/v1"
v1.measurementTagValues(bucket: v.bucket, measurement: "net", tag: "host")
```
and `bucket` is a variable defined as:
```
buckets()
|> filter(fn: (r) => r.name !~ /^_/)
|> rename(columns: {name: "_value"})
|> keep(columns: ["_value"])
```
If you update the query to hardcode the host filter, it seems to work:
` |> filter(fn: (r) => r.host == "rsavage.prod")`
```
2020-01-06T17:45:57.705828Z info Dispatcher panic {"log_id": "0KA~0z60000", "service": "storage-reads", "component": "dispatcher", "error": "panic: column _measurement:string is not of type int"}
goroutine 90206 [running]:
runtime/debug.Stack(0xc00d066ae0, 0x68d7500, 0x5a21611)
/usr/local/Cellar/go/1.13.4/libexec/src/runtime/debug/stack.go:24 +0x9d
github.com/influxdata/flux/execute.(*poolDispatcher).Start.func1.1(0xc00d066b40)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/dispatcher.go:81 +0x192
panic(0x56fa2c0, 0xc00e1af280)
/usr/local/Cellar/go/1.13.4/libexec/src/runtime/panic.go:679 +0x1b2
github.com/influxdata/flux/execute.CheckColType(...)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/table.go:1212
github.com/influxdata/flux/execute.(*ColListTableBuilder).checkCol(0xc0116cbc70, 0x0, 0x2, 0x4, 0xc00db5d6a8)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/table.go:1206 +0x215
github.com/influxdata/flux/execute.(*ColListTableBuilder).AppendInt(0xc0116cbc70, 0x0, 0x0, 0x17caf9f8, 0xcbecf5093b4d36c3)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/table.go:843 +0x42
github.com/influxdata/flux/execute.(*ColListTableBuilder).AppendValue(0xc0116cbc70, 0x0, 0x6945b20, 0xc00c343be0, 0x0, 0x0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/table.go:1139 +0x343
github.com/influxdata/flux/stdlib/universe.(*MergeJoinCache).join.func1(0xc0031eb980, 0x7, 0x6945b20, 0xc00c343be0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/stdlib/universe/join.go:909 +0x12b
github.com/influxdata/flux/values.(*object).Range(0xc00e349200, 0xc00c343d80)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/values/object.go:150 +0x94
github.com/influxdata/flux/stdlib/universe.(*MergeJoinCache).join(0xc00f63c820, 0xc0111e2640, 0xc0111e2be0, 0x832d8c0, 0xc0116cb600, 0x0, 0x0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/stdlib/universe/join.go:902 +0x4c9
github.com/influxdata/flux/stdlib/universe.(*MergeJoinCache).ForEachWithContext.func1(0x6944f40, 0xc0111e2c30, 0x56f4540, 0x832c130)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/stdlib/universe/join.go:631 +0x2ac
github.com/influxdata/flux/execute.(*GroupLookup).Range(0xc00da023f0, 0xc00db5dae0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/group_lookup.go:291 +0xa9
github.com/influxdata/flux/stdlib/universe.(*MergeJoinCache).ForEachWithContext(0xc00f63c820, 0xc00c3428e0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/stdlib/universe/join.go:619 +0xa6
github.com/influxdata/flux/execute.(*dataset).evalTriggers(0xc0128d06e0, 0xffffffffffffffff, 0x0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/dataset.go:113 +0x8c
github.com/influxdata/flux/execute.(*dataset).UpdateWatermark(0xc0128d06e0, 0x0, 0xc00db5dc18, 0xc00f63c978)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/dataset.go:98 +0x38
github.com/influxdata/flux/stdlib/universe.(*mergeJoinTransformation).UpdateWatermark(0xc005d693b0, 0x4d559cbb2a626fc2, 0x82c773c035f6a788, 0x15e75d47d8d2d0a0, 0x0, 0x0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/stdlib/universe/join.go:326 +0x189
github.com/influxdata/flux/execute.processMessage(0x6918b80, 0xc00d9fd920, 0x6922040, 0xc005d693b0, 0x68f6400, 0xc005610b80, 0xc00db5de00, 0x0, 0x0)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/transport.go:212 +0x3f9
github.com/influxdata/flux/execute.(*consecutiveTransport).processMessages(0xc00d066f60, 0x6918b80, 0xc00d9fd920, 0xa)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/transport.go:160 +0xc6
github.com/influxdata/flux/execute.(*poolDispatcher).run(0xc00d066b40, 0x6918b80, 0xc00d9fd920)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/dispatcher.go:132 +0x65
github.com/influxdata/flux/execute.(*poolDispatcher).Start.func1(0xc00d066b40, 0x6918b80, 0xc00d9fd920)
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/dispatcher.go:86 +0xcd
created by github.com/influxdata/flux/execute.(*poolDispatcher).Start
/Users/rsavage/go/pkg/mod/github.com/influxdata/flux@v0.57.0/execute/dispatcher.go:63 +0x7e
```