influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

Can we have IN filter?

Open flowbehappy opened this issue 11 years ago • 35 comments

Hi! Great job for InfluxDB.

And I wonder If it can support IN filter in where clause, so far it seems no supported:

SELECT * FROM mydb WHERE service IN ('aa', 'bb');

{
    "error": "error parsing query: found IN, expected SELECT, DELETE, SHOW, CREATE, DROP, GRANT, REVOKE, ALTER at line 1, char 321"
}

version: bdd469db26c483a0acdcadbb937829a3913d9be5

flowbehappy avatar Apr 03 '15 04:04 flowbehappy

We don't have support for IN right now but you can use OR, for the query you provided:

SELECT * from mydb WHERE service = 'aa' OR service = 'bb'

otoolep avatar Apr 03 '15 20:04 otoolep

I too would like this, and it should be easy with some query re-writing of the AST. Let me see if I can get to it.

otoolep avatar Aug 21 '15 23:08 otoolep

A potentially easier workaround than multiple OR statements would be to use a regex. I think it should be faster, too. E.g.

SELECT * from mydb WHERE service =~ /aa|bb/

That said, supporting IN would be great, especially for greater congruence with SQL.

beckettsean avatar Aug 21 '15 23:08 beckettsean

+1

srikara avatar Nov 06 '15 23:11 srikara

Hi Guys,

Is this feature request still valid? If it is valid, can I work on this task?

Thanks

ch33hau avatar Aug 04 '16 12:08 ch33hau

Yes, we are still interested in this feature.

jsternberg avatar Aug 17 '16 20:08 jsternberg

Thanks, I will start working on this during weekend.

ch33hau avatar Aug 18 '16 15:08 ch33hau

We have another usecase, the support for IN would make it possible to integrate Grafana's multiselect feature with influx @ch33hau do you have any update?

kalidasya avatar Jan 24 '17 14:01 kalidasya

Hi @kalidasya sorry I was stop it half way, will working on it sooner.

However, I found that IN already exists in influxdb for other purpose. Due to the way we code, might not able to use IN for the purpose of this issue. Is it possible to rename it to other syntax, eg, WITHIN?

ch33hau avatar Feb 15 '17 09:02 ch33hau

@ch33hau good to hear, WITHIN to me more time related but I also cannot really come up with anything better

kalidasya avatar Feb 15 '17 10:02 kalidasya

@ch33hau any updates on this?

stampy88 avatar Mar 30 '17 11:03 stampy88

This would be great guys! It's been a few years but ???

5k3105 avatar Apr 17 '17 23:04 5k3105

Please implement this faster, this feature is very very mich needed

taabodim avatar Apr 21 '17 16:04 taabodim

Is anybody working on this? I was thinking of taking a crack at this tomorrow

yshaul avatar May 10 '17 02:05 yshaul

There is nobody currently working on this at the moment. Feel free to give it a try.

jsternberg avatar May 10 '17 17:05 jsternberg

+1

omarmarquez avatar Sep 28 '17 21:09 omarmarquez

I would love this feature

MariaCobretti avatar Nov 14 '17 12:11 MariaCobretti

+1

innovationhub-asia avatar Nov 18 '17 05:11 innovationhub-asia

this feature any update?

xywendz avatar Jan 04 '18 07:01 xywendz

Looking forward to this. I would be fine using the WHERE .. OR or regex alternatives, but even won't work when the list of values passed to IN is very large (20k plus). Right now I don't see such a way to process this data without causing a "url too large" error.

maxp-edcast avatar Mar 01 '18 02:03 maxp-edcast