Integral results break up series

Hi,
I’m storing information about the duration of pumps. I’ve noticed when calculating the integral over a long period of time that it splits that series up by a duplicate tag.

I only have 2 tags in this series, ‘acid’ and ‘chlorine’ and would expect only 2 result sets, but am receiving 2 extras with the timestamp of 2018-mm-ddT12:00:00Z (or sometimes …T00:00:00Z). Wondering if this is a bug in the integrate function?

> SELECT integral("status") *(3/24/60/60) FROM "tank_pump" WHERE ("type" <> 'pump_change') AND time >= now() - 48h GROUP BY time(1h), "pump"
name: tank_pump
tags: pump=acid
time                 integral
----                 --------
2018-05-23T18:00:00Z 0.012100694444444445
2018-05-23T19:00:00Z 0.02109375
2018-05-23T20:00:00Z 0.008663194444444444
2018-05-23T22:00:00Z 0.009305555555555555
2018-05-23T23:00:00Z 0.01564236111111111
2018-05-24T00:00:00Z 0.00043402777777777775
2018-05-24T02:00:00Z 0.0018055555555555555
2018-05-24T03:00:00Z 0.020677083333333332
2018-05-24T04:00:00Z 0.01138888888888889
2018-05-24T05:00:00Z 0.022743055555555555
2018-05-24T06:00:00Z 0.021788194444444443
2018-05-24T07:00:00Z 0.021059027777777777
2018-05-24T08:00:00Z 0.021006944444444446
2018-05-24T09:00:00Z 0.020746527777777777
2018-05-24T10:00:00Z 0.0017013888888888888
2018-05-24T13:00:00Z 0.002309027777777778
2018-05-24T14:00:00Z 0.020572916666666666
2018-05-24T15:00:00Z 0.021006944444444446
2018-05-24T16:00:00Z 0.020572916666666666
2018-05-24T17:00:00Z 0.020972222222222222
2018-05-24T18:00:00Z 0.02095486111111111
2018-05-24T19:00:00Z 0.0209375
2018-05-24T20:00:00Z 0.020746527777777777
2018-05-24T21:00:00Z 0.013680555555555555
2018-05-24T22:00:00Z 0.020815972222222222
2018-05-24T23:00:00Z 0.024270833333333332

name: tank_pump
tags: pump=chlorine
time                 integral
----                 --------
2018-05-25T00:00:00Z 0.006232638888888889
2018-05-25T01:00:00Z 0.020243055555555556
2018-05-25T02:00:00Z 0.014288194444444444
2018-05-25T04:00:00Z 0.008350694444444444
2018-05-25T05:00:00Z 0.021128472222222222
2018-05-25T06:00:00Z 0.02140625
2018-05-25T07:00:00Z 0.021111111111111112
2018-05-25T08:00:00Z 0.02079861111111111
2018-05-25T09:00:00Z 0.020989583333333332
2018-05-25T10:00:00Z 0.013385416666666667
2018-05-25T11:00:00Z 0.0023784722222222224

name: tank_pump
tags: pump=acid
time                 integral
----                 --------
2018-05-25T00:00:00Z 0.013385416666666667

name: tank_pump
tags: pump=chlorine
time                 integral
----                 --------
2018-05-25T12:00:00Z 0.0008159722222222223

If I run the same query with max or sum aggregation I get the results I would expect:

> SELECT sum("status") *(3/24/60/60) FROM "tank_pump" WHERE ("type" <> 'pump_change') AND time >= now() - 48h GROUP BY time(1h), "pump"
name: tank_pump
tags: pump=acid
time                 sum
----                 ---
2018-05-23T12:00:00Z
2018-05-23T13:00:00Z
2018-05-23T14:00:00Z
2018-05-23T15:00:00Z
2018-05-23T16:00:00Z
2018-05-23T17:00:00Z
2018-05-23T18:00:00Z 0.0021527777777777778
2018-05-23T19:00:00Z 0.00375
2018-05-23T20:00:00Z 0.0015277777777777779
2018-05-23T21:00:00Z
2018-05-23T22:00:00Z 0.0016666666666666666
2018-05-23T23:00:00Z 0.002777777777777778
2018-05-24T00:00:00Z 0.00006944444444444444
2018-05-24T01:00:00Z
2018-05-24T02:00:00Z 0.00024305555555555555
2018-05-24T03:00:00Z 0.0036458333333333334
2018-05-24T04:00:00Z 0.001979166666666667
2018-05-24T05:00:00Z 0.0036805555555555554
2018-05-24T06:00:00Z 0.0036458333333333334
2018-05-24T07:00:00Z 0.0036805555555555554
2018-05-24T08:00:00Z 0.00375
2018-05-24T09:00:00Z 0.003715277777777778
2018-05-24T10:00:00Z 0.0003125
2018-05-24T11:00:00Z
2018-05-24T12:00:00Z
2018-05-24T13:00:00Z 0.00038194444444444446
2018-05-24T14:00:00Z 0.003715277777777778
2018-05-24T15:00:00Z 0.00375
2018-05-24T16:00:00Z 0.0036805555555555554
2018-05-24T17:00:00Z 0.00375
2018-05-24T18:00:00Z 0.003715277777777778
2018-05-24T19:00:00Z 0.003715277777777778
2018-05-24T20:00:00Z 0.0036805555555555554
2018-05-24T21:00:00Z 0.0024305555555555556
2018-05-24T22:00:00Z 0.003611111111111111
2018-05-24T23:00:00Z 0.0044444444444444444
2018-05-25T00:00:00Z 0.002361111111111111
2018-05-25T01:00:00Z
2018-05-25T02:00:00Z
2018-05-25T03:00:00Z
2018-05-25T04:00:00Z
2018-05-25T05:00:00Z
2018-05-25T06:00:00Z
2018-05-25T07:00:00Z
2018-05-25T08:00:00Z
2018-05-25T09:00:00Z
2018-05-25T10:00:00Z
2018-05-25T11:00:00Z
2018-05-25T12:00:00Z

name: tank_pump
tags: pump=chlorine
time                 sum
----                 ---
2018-05-23T12:00:00Z
2018-05-23T13:00:00Z
2018-05-23T14:00:00Z
2018-05-23T15:00:00Z
2018-05-23T16:00:00Z
2018-05-23T17:00:00Z
2018-05-23T18:00:00Z
2018-05-23T19:00:00Z
2018-05-23T20:00:00Z
2018-05-23T21:00:00Z
2018-05-23T22:00:00Z
2018-05-23T23:00:00Z
2018-05-24T00:00:00Z
2018-05-24T01:00:00Z
2018-05-24T02:00:00Z
2018-05-24T03:00:00Z
2018-05-24T04:00:00Z
2018-05-24T05:00:00Z
2018-05-24T06:00:00Z
2018-05-24T07:00:00Z
2018-05-24T08:00:00Z
2018-05-24T09:00:00Z
2018-05-24T10:00:00Z
2018-05-24T11:00:00Z
2018-05-24T12:00:00Z
2018-05-24T13:00:00Z
2018-05-24T14:00:00Z
2018-05-24T15:00:00Z
2018-05-24T16:00:00Z
2018-05-24T17:00:00Z
2018-05-24T18:00:00Z
2018-05-24T19:00:00Z
2018-05-24T20:00:00Z
2018-05-24T21:00:00Z
2018-05-24T22:00:00Z
2018-05-24T23:00:00Z
2018-05-25T00:00:00Z 0.0011111111111111111
2018-05-25T01:00:00Z 0.003611111111111111
2018-05-25T02:00:00Z 0.0025694444444444445
2018-05-25T03:00:00Z
2018-05-25T04:00:00Z 0.0014583333333333334
2018-05-25T05:00:00Z 0.0036805555555555554
2018-05-25T06:00:00Z 0.0036805555555555554
2018-05-25T07:00:00Z 0.003715277777777778
2018-05-25T08:00:00Z 0.003715277777777778
2018-05-25T09:00:00Z 0.00375
2018-05-25T10:00:00Z 0.002361111111111111
2018-05-25T11:00:00Z 0.00041666666666666664
2018-05-25T12:00:00Z 0.0003125

Thoughts?

1 Like

Looks like fredrike posted the exact same question on Github as an issue.

2 Likes