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

[0.9.3 nightly] comparison operators on epoch timestamps always return true if no units supplied #3719

Closed
beckettsean opened this issue Aug 18, 2015 · 1 comment · Fixed by #3721
Assignees

Comments

@beckettsean
Copy link
Contributor

There's something badly broken with comparison operators in the latest 0.9.3 nightly.

Insert two points with small epoch timestamps (in seconds):

root@sean-test:~# curl -i -XPOST 'http://localhost:8086/write?db=foo&precision=s' --data-binary 'thing value=50 900'
HTTP/1.1 204 No Content
root@sean-test:~# curl -i -XPOST 'http://localhost:8086/write?db=foo&precision=s' --data-binary 'thing value=60 910'
HTTP/1.1 204 No Content

Select the points in the CLI:

> select * from thing
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50
1970-01-01T00:15:10Z    60

Now it gets weird. This returns nothing, although it should at least return the first point

> select * from thing where time <= 900s

Now without the units, and it returns both points. Timestamp should be nanoseconds by default, but it doesn't matter what I use in the comparison, it always returns both points:

> select * from thing where time <= 900
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50
1970-01-01T00:15:10Z    60

> select * from thing where time <= 9
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50
1970-01-01T00:15:10Z    60

> select * from thing where time = 9
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50
1970-01-01T00:15:10Z    60

> select * from thing where time = 9099099900999000990
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50
1970-01-01T00:15:10Z    60

Using explicit seconds for the time behaves as expected:

> select * from thing where time =900s
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50

> select * from thing where time = 910s
name: thing
-----------
time            value
1970-01-01T00:15:10Z    60

> select * from thing where time = 911s
> select * from thing where time >= 911s
> select * from thing where time >= 900s
name: thing
-----------
time            value
1970-01-01T00:15:00Z    50
1970-01-01T00:15:10Z    60

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 a pull request may close this issue.

4 participants