- Full details of your operating system (or distribution) e.g. 64-bit Ubuntu 14.04.
- Running InfluxDB/Kapacitor/Chronograf as Docker containers on MacOSX, latest Docker.
- The version of Kapacitor you are running
- Whether you installed it using a pre-built package, or built it from source.
- Official Docker container
We are running into an issue with TICKscript and its groupBy behaviour.
We have two sets of measurements, indoor_temperatures and outdoor_temperatures, which we query with a batch.
The queries look as follows:
var out_temp = batch
|query('SELECT mean(temperature) FROM yyyy')
.every(10s)
.period(120d)
.groupBy(time(1h))
.fill(0)
var in_temp = batch
|query('SELECT mean(temperature) FROM xxxx')
.every(10s)
.period(120d)
.groupBy(time(1h))
.fill(0)
If we HTTP out both of them, they create the following sets of data:
{
"series": [
{
"name": "outdoor_temperatures",
"columns": [
"time",
"mean"
],
"values": [
[
"2017-09-20T17:00:00Z",
0
],
[
"2017-09-20T18:00:00Z",
11.5
]
... the rest
]
}
]
}
{
"series": [
{
"name": "indoor_measurements",
"columns": [
"time",
"mean"
],
"values": [
[
"2017-09-20T17:00:00Z",
585.44012944984
],
[
"2017-09-20T18:00:00Z",
592.94890510949
]
... the rest
]
}
]
}
Now we do a full join of them, which gives us expected results
out_temp
|join(in_temp)
.as('out_temp_mean', 'in_temp_mean')
.tolerance(5m)
.fill(0)
httpOut:
{
"series": [
{
"name": "outdoor_temperatures",
"columns": [
"time",
"in_temp_mean.mean",
"out_temp_mean.mean"
],
"values": [
[
"2017-09-20T17:00:00Z",
586.10175438596,
0
],
[
"2017-09-20T18:00:00Z",
592.94890510949,
11.5
]
... the rest
]
}
]
}
Which looks perfect. The issue raises when we want to round the out_temp_mean.mean down and groupBy it
So we go ahead and extend the script
out_temp
|join(in_temp)
.as('out_temp_mean', 'in_temp_mean')
.tolerance(5m)
.fill(0)
|eval(lambda: string(floor("out_temp_mean.mean")))
.as('bucket')
.tags('bucket')
.keep('out_temp_mean.mean', 'in_temp_mean.mean')
After which the output STILL looks as it should:
{
"series": [
{
"name": "outdoor_temperatures",
"columns": [
"time",
"in_temp_mean.mean",
"out_temp_mean.mean",
"bucket"
],
"values": [
[
"2017-09-20T17:00:00Z",
586.99190283401,
0,
"0"
],
[
"2017-09-20T18:00:00Z",
592.94890510949,
11.5,
"11"
]
]
}
]
}
Now only thing left is to group the values by the new tag bucket:
out_temp
|join(in_temp)
.as('out_temp_mean', 'in_temp_mean')
.tolerance(5m)
.fill(0)
|eval(lambda: string(floor("out_temp_mean.mean")))
.as('bucket')
.tags('bucket')
.keep('out_temp_mean.mean', 'in_temp_mean.mean')
|groupBy('bucket')
After which everything goes awry and we are greeted with series: null
Is this expected behaviour? A bug? Or something else?
We are running into an issue with TICKscript and its groupBy behaviour.
We have two sets of measurements, indoor_temperatures and outdoor_temperatures, which we query with a batch.
The queries look as follows:
If we HTTP out both of them, they create the following sets of data:
{ "series": [ { "name": "outdoor_temperatures", "columns": [ "time", "mean" ], "values": [ [ "2017-09-20T17:00:00Z", 0 ], [ "2017-09-20T18:00:00Z", 11.5 ] ... the rest ] } ] } { "series": [ { "name": "indoor_measurements", "columns": [ "time", "mean" ], "values": [ [ "2017-09-20T17:00:00Z", 585.44012944984 ], [ "2017-09-20T18:00:00Z", 592.94890510949 ] ... the rest ] } ] }Now we do a full join of them, which gives us expected results
httpOut:
{ "series": [ { "name": "outdoor_temperatures", "columns": [ "time", "in_temp_mean.mean", "out_temp_mean.mean" ], "values": [ [ "2017-09-20T17:00:00Z", 586.10175438596, 0 ], [ "2017-09-20T18:00:00Z", 592.94890510949, 11.5 ] ... the rest ] } ] }Which looks perfect. The issue raises when we want to round the
out_temp_mean.meandown and groupBy itSo we go ahead and extend the script
After which the output STILL looks as it should:
{ "series": [ { "name": "outdoor_temperatures", "columns": [ "time", "in_temp_mean.mean", "out_temp_mean.mean", "bucket" ], "values": [ [ "2017-09-20T17:00:00Z", 586.99190283401, 0, "0" ], [ "2017-09-20T18:00:00Z", 592.94890510949, 11.5, "11" ] ] } ] }Now only thing left is to group the values by the new tag bucket:
After which everything goes awry and we are greeted with
series: nullIs this expected behaviour? A bug? Or something else?