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

handle aggregations with 0 intervals #2547

Merged
merged 1 commit into from
May 12, 2015

Conversation

neonstalwart
Copy link
Contributor

fixes #2487

i wondered whether or not a 0-length interval should be valid for aggregating but then i considered that if we eventually allow multiple points to be written to the same time then aggregations over 0-length intervals seem valid.

cc @toddboom

@toddboom
Copy link
Contributor

+1

@pauldix
Copy link
Member

pauldix commented May 12, 2015

The query in your test won't actually work. You can't have two data points at the same nano-second. And this query is asking for all points at the exact nano-second at 2000-01-01 00:00:05Z which has everything after the 5 set to zero.

Zero intervals aren't actually valid for aggregate queries. The correct way to do this query would be:

SELECT count(value) FROM cpu WHERE time >= '2000-01-01 00:00:05' and time < '2000-01-01 00:00:06'

The better thing to do would be to actually return an error if the query has an aggregate function of any kind and a time = 'some val' They need to have an interval represented.

@toddboom
Copy link
Contributor

No interest in being able to support a count of a single value?

@neonstalwart
Copy link
Contributor Author

@pauldix so the query is the thing being tested (see #2487) so it needs to stay the same. if i have the wrong expected value for the result then that should change. however, (before i change it) it's my understanding that the intent is to eventually allow more than one point at the same exact nano-second. when that's the case wouldn't aggregates of an exact time make sense?

@toddboom
Copy link
Contributor

@pauldix i think this may also fix the non-aggregate case, fwiw

@neonstalwart
Copy link
Contributor Author

@toddboom i'm not sure what you're referring to but i think queries without aggregates go here https://github.com/influxdb/influxdb/pull/2547/files#diff-135f9f554ea5c27580f7c818e4ae53a1R81 which means this doesn't affect them (for good or bad). maybe i'm misunderstanding what you mean.

@toddboom
Copy link
Contributor

@neonstalwart nope, i was wrong - i was testing for an old issue that i think was fixed elsewhere. you're correct.

@pauldix
Copy link
Member

pauldix commented May 12, 2015

@neonstalwart we don't currently have a plan to enable points at the same nano-second within an individual series. Although I guess we could have points at the same nano-second across multiple series. So if you have a query like that but there are points with multiple tags then it would work.

At the very least I'd like to see the test in server integration updated to have two data points written in with different tags at the same nano-second and see if the result is correct (rather than a null result).

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@neonstalwart
Copy link
Contributor Author

we don't currently have a plan to enable points at the same nano-second within an individual series

ok, i misunderstood #1920 but i see now how it's different.

test updated - waiting for green.

@neonstalwart
Copy link
Contributor Author

this failure is unrelated to my change... can someone start it again?

@toddboom
Copy link
Contributor

on it

@neonstalwart
Copy link
Contributor Author

@pauldix how's that now?

name: "aggregation with no interval",
query: `SELECT count(value) FROM cpu WHERE time = '2000-01-01 00:00:00'`,
queryDb: "%DB%",
expected: `{"results":[{"series":[{"name":"cpu","columns":["time","count"],"values":[["2000-01-01T00:00:00Z",2]]}]}]}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are these 2 points being written in? I assume it's in another test, but I can't find to validate that 2 is the correct number :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test above it writes the points and we are not resetting between tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, makes sense. At some point we should really be resetting, but that'll have to come later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, @otoolep suggested to avoid resetting when possible to keep the time of the tests down.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've seen test resets that wipe that database, and write all the same data again. Seems kinda pointless. Why not just write a set of data for a given related set of tests, and then execute the various queries. Of course, reset is there when you need it, but if we start needlessly resetting before every write, our test-run times will just grow to many minutes.

As always, it's a judgement call.

pauldix added a commit that referenced this pull request May 12, 2015
handle aggregations with 0 intervals
@pauldix pauldix merged commit 2e57952 into influxdata:master May 12, 2015
@pauldix
Copy link
Member

pauldix commented May 12, 2015

Thanks @neonstalwart!

@neonstalwart neonstalwart deleted the fix/2487 branch May 12, 2015 20:42
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

Successfully merging this pull request may close these issues.

Query for exact timestamp causes panic
4 participants