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.4.1] DROP SERIES with a field in the WHERE clause always drops all points in the measurement #4280

Closed
simcap opened this issue Sep 30, 2015 · 8 comments
Assignees
Milestone

Comments

@simcap
Copy link
Contributor

simcap commented Sep 30, 2015

I have got a series with values equal to 0. Since we decided not to push any value that is 0 in our InfluxDB, I want to clean up this serie and remove the existing values equal to 0. Here is what I did:

> select count(value) from p2p
name: p2p
---------
time      count
1970-01-01T00:00:00Z  286216

> select count(value) from p2p where value=0
name: p2p
---------
time      count
1970-01-01T00:00:00Z  113630

> drop series from p2p where value=0
> select count(value) from p2p where value=0
> select count(value) from p2p
name: p2p
---------
time      count
1970-01-01T00:00:00Z  3

I am surprised that is removed everything (the 3 entries is because the DB get populated at the same time by live clients).

Is the DROP series for a specific value supported?

@simcap
Copy link
Contributor Author

simcap commented Sep 30, 2015

(i have just updated the main description above)

@beckettsean
Copy link
Contributor

I believe the WHERE clause for DROP SERIES only operates on tags. For it to work on fields (like value) it would have to scan every point in the series, as field values are unindexed.

@simcap
Copy link
Contributor Author

simcap commented Oct 2, 2015

Ok thanks for the info.

@beckettsean
Copy link
Contributor

@simcap I am closing this in favor of another issue open on DROP SERIES (#4276). It appears the WHERE clause is not being properly evaluated

@beckettsean
Copy link
Contributor

Actually, looking more closely these are two different issues. I'm re-opening this one to focus on the field matching not working. (I don't think it's supposed to work, but it should error or do nothing, not match all points instead.)

@beckettsean beckettsean reopened this Oct 2, 2015
@beckettsean
Copy link
Contributor

It appears that a WHERE clause containing a field key will match every point in the series, regardless:

> SELECT * FROM h2o_feet limit 4
name: h2o_feet
--------------
time                location    status!             water_level
1970-01-01T00:00:01.439856Z santa_monica    below three feet        2.064
1970-01-01T00:00:01.439856Z coyote_creek    between six and nine feet   8.12
1970-01-01T00:00:01.43985636Z   coyote_creek    between six and nine feet   8.005
1970-01-01T00:00:01.43985636Z   santa_monica    below three feet        2.116

> drop series from h2o_feet where water_level = 'foo'
> SELECT * FROM h2o_feet limit 4
> SELECT * FROM h2o_feet 
> 

Note that the WHERE water_level = 'foo' cannot ever be true, since water_level has floats and foo is a string. However, the DROP SERIES result suggests that the WHERE clause evaluated to true for every point in the measurement.

@beckettsean beckettsean changed the title Drop series containing a specific value [0.9.4.1] DROP SERIES with a field in the WHERE clause always drops all points in the measurement Oct 2, 2015
@beckettsean
Copy link
Contributor

See also #4276

@beckettsean
Copy link
Contributor

Might be related somehow to this generic WHERE field = bug: #4306

dgnorton added a commit that referenced this issue Oct 9, 2015
fix #4280: only drop points matching WHERE clause
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

4 participants