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

cannot use OR with absolute time in where clause #3290

Closed
beckettsean opened this issue Jul 10, 2015 · 9 comments
Closed

cannot use OR with absolute time in where clause #3290

beckettsean opened this issue Jul 10, 2015 · 9 comments

Comments

@beckettsean
Copy link
Contributor

> select * from system_load1 where time = '2015-07-10T17:34:13.960621663Z'
name: system_load1
tags: host=catalyst
time                value
----                -----
2015-07-10T17:34:13.960621663Z  1.93

> select * from system_load1 where time = '2015-07-10T17:33:59.955702621Z'
name: system_load1
tags: host=catalyst
time                value
----                -----
2015-07-10T17:33:59.955702621Z  1.31

> select * from system_load1 where time = '2015-07-10T17:34:13.960621663Z' or time = '2015-07-10T17:33:59.955702621Z'
name: system_load1
tags: host=catalyst
time    value
----    -----

> 
@jsternberg
Copy link
Contributor

The problem here is that the TimeRange function will only return one time range while this one effectively has multiple time ranges. I can modify it to use multiple time ranges, but it does bring up a pretty important question. If a time range doesn't have a start or end, what's the default? For the end, we've used now(), but what should be used for the beginning? If you do this:

SELECT mean(value) FROM cpu WHERE time < '2000-01-01T00:00:00Z' OR time >= now() - 10m GROUP BY time(1m)

While a bit nonsensical, it will give a very rude awakening when it tries to fill in every 1 minute interval from 1970 until 2000 along with the last 10 minutes.

@jsternberg jsternberg assigned jsternberg and unassigned dgnorton Mar 15, 2016
@jsternberg jsternberg modified the milestones: 0.12.0, Future Point Release Mar 15, 2016
@beckettsean
Copy link
Contributor Author

@jsternberg to date, the assumed lower bound has always been epoch 0 unless otherwise specified. There are errors which fire on any query that has a GROUP BY clause but no WHERE time clause. There are also errors which fire if the number of GROUP BY buckets exceeds 99999.

Did we rip out those behaviors with the new query engine?

@jsternberg
Copy link
Contributor

We don't currently have anything stopping queries from going out of control. I'd also argue that 99999 seems very high to begin with.

What kind of restrictions should we put on this?

@beckettsean
Copy link
Contributor Author

@jsternberg I think this is a larger discussion to have with @jwilder and more of the team.

@jwilder
Copy link
Contributor

jwilder commented Mar 16, 2016

This may be a option we should add to #6024

jsternberg added a commit that referenced this issue Mar 28, 2016
A bigger refactor of these functions is needed to support #3290, but
this will work for the more common case that someone uses double quotes
instead of single quotes when surrounding a time literal.

Fixes #3932.
@jsternberg jsternberg modified the milestones: 0.13.0, 0.12.0 Mar 29, 2016
benbjohnson pushed a commit that referenced this issue Mar 31, 2016
A bigger refactor of these functions is needed to support #3290, but
this will work for the more common case that someone uses double quotes
instead of single quotes when surrounding a time literal.

Fixes #3932.
@jsternberg jsternberg modified the milestones: Longer term, 0.13.0 Apr 11, 2016
@jsternberg jsternberg removed their assignment Apr 29, 2016
@jlennox
Copy link

jlennox commented Jul 9, 2016

This issue would be a good candidate for "Frequently Encountered Issues"

Should this condition be treated as an exception by influx?

@beckettsean
Copy link
Contributor Author

Thanks for the suggestion, @jlennox.

I created influxdata/docs.influxdata.com-ARCHIVE#526 to get this into the docs.

@jwilder
Copy link
Contributor

jwilder commented Aug 26, 2016

OR with multiple time ranges is not currently supported. This should return an error, but returning an error would be a breaking change to the query language. Fixing this needs to be done with care to not break the API.

@jsternberg
Copy link
Contributor

I'm going to close this in favor of #7530. That includes the reason why this is an issue and includes the proposed fix in a way that I think is easier to understand.

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

No branches or pull requests

6 participants