Count() null if zero measurements found

Hello,

I found an annoying thing that was annoying in InfluxQL already:

Sometimes I need to count measurements for specific Criteria and do Calculation with the counts. If for some reason zero Measurements match a given Criteria the count() aggregate doesn’t return the number 0. Instead it returns null, which makes it hard to build consistent Graphs…

from(bucket: “treasmap/autogen”)
|> range(start: -12h)
|> filter(fn: (r) => r._measurement == “foo” and r._field == “bar” and r.tag1 == “somevalue” and r.tag2== “someothervalue” and r.tag3== “0”)
|> window(every:inf)
|> group(columns: [“time”])
|> count()

Fill won’t help me here either, because it doesn’t fill the result value of the aggregate.

Do I completely miss something here?

There’s a Github Issue from 2016 at [Feature Request] COUNT(): return zeros instead of no results · Issue #6412 · influxdata/influxdb · GitHub, which has been triaged and flagged.

regards,
mephisto

I tried to find a Workaround with a conditional Logic, but didn’t success either. if conditionals don’t seem to be implemented in Flux for 1.7.7

user@host:~# curl -sL -I localhost:8086/ping
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: a8d084f0-b9c0-11e9-8ea0-469d01dc02af
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.7.7
X-Request-Id: a8d084f0-b9c0-11e9-8ea0-469d01dc02af
Date: Thu, 08 Aug 2019 09:41:12 GMT

Any Idea?

Conditionals will be included with the Flux version shipping in 1.7.8, which is in QA now and will hopefully release soon!

dg

hi @davidgs, thanks for feedback.

is there any estimate, when we can expect the next Influx 1.7/1.8 release?

regards