Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API should support filling in zero values for group by intervals with no data #117

Closed
pauldix opened this issue Dec 11, 2013 · 5 comments
Closed

Comments

@pauldix
Copy link
Member

pauldix commented Dec 11, 2013

Heard this request and I don't think it's uncommon. Maybe something like this:

select count(val) from some_series group by time(5m) fill(0)

select count(state) from some_series group by time(5m), state fill(0)

The second query should fill in zero values for every unique state it has seen so far.

@ghost ghost assigned jvshahid Dec 11, 2013
@FGRibreau
Copy link

Nice work! I can confirm you that I was always doing this kind of thing client-side, that's a really helpful feature!

@consense
Copy link

consense commented Apr 9, 2014

This is indeed a nice feature, but currently it only fills zero values between min(time) and max(time) even if the query was looking at a larger time interval.

i.e.:
datapoints at July 1st 2012 12:00 and August 1st 2012 12:00
Query:
SELECT sum(someintcolumn) FROM series WHERE time > '2012-01-01' AND time < '2012-12-31' GROUP BY time(1d) fill(0);

What happens is that the query returns 32 results (days between July 1st and AUgust 1st) instead of 365 as I would expect given the WHERE clause.

@jvshahid
Copy link
Contributor

jvshahid commented Apr 9, 2014

We can't make this the default behavior. The default start time of the query is the lowest time that could be represented by an int64. If the user issued select count(value) from foo group by time(10m) fill(0) it will return an insane number of points. What you're saying doesn't sound crazy, but we need to tweak it so we don't accidentally generate an insance number of points.

@consense
Copy link

consense commented Apr 9, 2014

Thanks for your detailed explanation John - makes sense.

Filling non-existing buckets with zeros on the client side works fine as well - was just surprised when I tested the fill(0) function.

@pauldix
Copy link
Member Author

pauldix commented Apr 9, 2014

This is a thing we should support. See #426 to track progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants