InfluxDB 1.7.9 - Fill function in a subquery when outer query groups by time bug

When using fill function ( fill(value)/fill(previous)/fill(linear)) in a subquery there is a bug when outer query uses group by time.
This is subquery:

SELECT mean(value) AS value FROM measures WHERE “measurementId” = ‘performance.int000’ AND time >= 1582192277s AND time < 1582192297s GROUP BY measurementId,instanceId,time(10s) fill(-1) ORDER BY time ASC

name: measures
tags: instanceId=responder-00, measurementId=performance.int000
time value


2020-02-20T09:51:10Z 10
2020-02-20T09:51:20Z -1
2020-02-20T09:51:30Z -1

name: measures
tags: instanceId=responder-01, measurementId=performance.int000
time value


2020-02-20T09:51:10Z 10
2020-02-20T09:51:20Z 10
2020-02-20T09:51:30Z -1

so two series are returned (responder-00/responder-01), missing values in 10s intervals are replaced by -1, when this query is used as a subquery whilst outer query uses GROUP BY time this happens:

SELECT sum(value) FROM (SELECT mean(value) AS value FROM measures WHERE “measurementId” = ‘performance.int000’ AND time >= 1582192277s AND time < 1582192297s GROUP BY measurementId,instanceId,time(10s) fill(-1) ORDER BY time ASC) GROUP BY time(10s)

fill(none)
name: measures
time sum


2020-02-20T09:51:10Z 10
2020-02-20T09:51:20Z -1
2020-02-20T09:51:30Z -1
2020-02-20T09:51:10Z 10
2020-02-20T09:51:20Z 10
2020-02-20T09:51:30Z -1

those series were just somehow badly merged and no sum aggregation happened. I expect sum in 10s interval to happen so it should return this:

2020-02-20T09:51:10Z 20
2020-02-20T09:51:20Z 9
2020-02-20T09:51:30Z -2

Few things I also found out:

  • if fill(none) is used in subquery it works as expected (but I will not have sums of default values there)
  • if group by time is omitted in outer query it also works as expected (but I will not have 10s aggregations)
  • if subquery result is stored in separate table and outer query is applied on that table it works as expected
  • when applied on larger example, results were even more strange, e.g. 2 series of five records (50 seconds interval) in a subquery produced 30 rows of results, each timestamp was in the result 6 times

Is there any workaround so I can achieve expected behavior using subquery?