Kapacitor: Support subquery inside tick script

Created on 15 Feb 2017  ·  10Comments  ·  Source: influxdata/kapacitor

InfluxDB 1.2 supports subqueries, but when trying to define a tick script of type batch with subqueries, we get an error.
The query we run:
SELECT COUNT(DISTINCT(last)) FROM (SELECT LAST("version")  FROM "dbname"."autogen".measurement where time > now() - 120h GROUP BY "host") group by cluster
The error:

failed to parse InfluxQL query: found (, expected identifier at line 1, char 35

Most helpful comment

Hello! I have the same problem with Kapacitor v1.3:

failed to parse InfluxQL query: found (, expected identifier at line 2, char 38

@nathanielc could you precise a bit more the workaround you were talking about?

All 10 comments

I found the same issue. I really need this; why don't kapacitor queries support the full influxdb query language?

@scotloach They typically do, the current version of Kapacitor (v1.2) is using InfluxDB version 1.1 and sub-queries were introduced in version 1.2 of InfluxDB. There are some internal changes that need to happen inorder for Kapacitor to upgrade. They are planned and being worked on but for now Kapacitor is lagging slightly.

That said Kapacitor is capable of doing equivalent work. Meaning just make the inner query the batch query and implement the outer query in TICKscript.

Hello! I have the same problem with Kapacitor v1.3:

failed to parse InfluxQL query: found (, expected identifier at line 2, char 38

@nathanielc could you precise a bit more the workaround you were talking about?

We are working with Kapacitor 1.4. and InfluxDB 1.4. and while the subqueries still don't work, we worked around the issue by InfluxDBOut:ing the subqueries to an measurement and then running another batch query against that semi-temporal measurement. Seems a bit wasteful, but seems to work.

Hi,

do you guys know in which version there will be support for subqueries in Kapacitor? It would be good to have Kapacitor supporting it.

@nathanielc do you know if this feature is already planned into the kapacitor roadmap ? and for which (estimation) kapacitor version ?

Did this feature supported in 1.5.3?

Any recent news regarding this issue? It would be really helpful for performing arithmetic in batch queries prior to the groupBy(time(...)), which is as I see it not possible now.
In my case I want to realize an equivalent of teh following query:

SELECT MEAN(value), MEAN(value_sq) FROM (SELECT value AS value, value * value AS value_SQ FROM ...) GROUP BY TIME(...)

Using streams instead is not possible in my case because I later on combine this metric with historical data.

You know what would be useful? A command to take an InfluxDB query and produce the equivalent TICKscript. Assuming that the capabilties of TICKscript and InfluxQL are more or less equivalent...

Are they equivalent?

I have an InfluxQL query with nested SELECT and would like to have it run as a continuous query equivalent in Kapacitor...

still not working in version 1.5.3,Is there have instead of usage method?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

desa picture desa  ·  7Comments

davidhiendl picture davidhiendl  ·  6Comments

seb-koch picture seb-koch  ·  5Comments

ASKozienko picture ASKozienko  ·  7Comments

phemmer picture phemmer  ·  5Comments