Skip to content

Subqueries can only perform math on two fields #8848

Closed
@NotionCommotion

Description

System info:

InfluxDB shell version 1.3.5
CentOS Linux release 7.3.1611

Steps to reproduce:

Perform the following query from the shell:
SELECT p FROM (SELECT P51 + P55 + P57 AS p FROM L11)

Expected behavior:

The same results as: SELECT P51 + P55 + P57 AS p FROM L11

Actual behavior:

The query runs indefinitely (at least 5 hours) and the shell locks up requiring me to ctrl-z to exit and then kill the query.

Additional info:

My reason to do this is to perform math within an aggregate function using the subquery workaround described by:
https://docs.influxdata.com/influxdb/v1.3/troubleshooting/frequently-asked-questions/#how-do-i-perform-mathematical-operations-within-a-function
https://docs.influxdata.com/influxdb/v1.3/query_language/data_exploration/#subqueries

I am successfully able to perform math on three fields in the main query.
SELECT P51 + P55 + P57 AS p FROM L11

I am successfully able to perform math on two fields in a subquery, and perform an aggregate function on the results.
SELECT p FROM (SELECT P51 + P55 AS p FROM L11)
SELECT mean(p) AS meanp, count(p) AS countp FROM (SELECT P51+P55 AS p FROM L11)

My desired query, however, displays the same behaviour as the query listed under Steps to Reproduce.
SELECT mean(p) AS meanp, count(p) AS countp FROM (SELECT P51 + P55 + P57 AS p FROM L11)

Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z opened service service=subscriber
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Starting monitor system service=monitor
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z 'build' registered for diagnostics monitoring service=monitor
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z 'runtime' registered for diagnostics monitoring service=monitor
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z 'network' registered for diagnostics monitoring service=monitor
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z 'system' registered for diagnostics monitoring service=monitor
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Starting precreation service with check interval of 10m0s, advance period of 30m0s service=shard-precreation
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Starting snapshot service service=snapshot
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Starting continuous query service service=continuous_querier
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Starting HTTP service service=httpd
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Authentication enabled:false service=httpd
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Listening on HTTP:[::]:8086 service=httpd
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Starting retention policy enforcement service with check interval of 30m0s service=retention
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Listening for signals
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Storing statistics in database '_internal' retention policy 'monitor', at interval 10s service=monitor
Sep 19 15:08:49 devserver influxd[45661]: [I] 2017-09-19T15:08:49Z Sending usage statistics to usage.influxdata.com
Sep 19 15:08:52 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:08:52 +0000] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.3.5" 72ac73a0-9d4c-11e7-8001-000000000000 112
Sep 19 15:08:59 devserver influxd[45661]: [I] 2017-09-19T15:08:59Z SHOW DATABASES service=query
Sep 19 15:08:59 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:08:59 +0000] "POST /query?db=&epoch=ns&q=SHOW+DATABASES HTTP/1.1" 200 170 "-" "InfluxDBShell/1.3.5" 76e86642-9d4c-11e7-8002-000000000000 731
Sep 19 15:09:10 devserver influxd[45661]: [I] 2017-09-19T15:09:10Z SELECT P51 + P55 + P57 AS p FROM greenbean_dl.autogen.L11 service=query
Sep 19 15:09:10 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:09:10 +0000] "POST /query?chunked=true&db=greenbean_dl&epoch=ns&q=SELECT+P51+%2B+P55+%2B+P57+AS+p+FROM+L11 HTTP/1.1" 200 401085 "-" "InfluxDBShell/1.
Sep 19 15:09:19 devserver influxd[45661]: [I] 2017-09-19T15:09:19Z SELECT p FROM (SELECT P51 + P55 AS p FROM greenbean_dl.autogen.L11) service=query
Sep 19 15:09:19 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:09:19 +0000] "POST /query?chunked=true&db=greenbean_dl&epoch=ns&q=SELECT+p+FROM+%28SELECT+P51+%2B+P55+AS+p+FROM+L11%29 HTTP/1.1" 200 130435 "-" "Infl
Sep 19 15:09:27 devserver influxd[45661]: [I] 2017-09-19T15:09:27Z SELECT mean(p) AS meanp, count(p) AS countp FROM (SELECT P51 + P55 AS p FROM greenbean_dl.autogen.L11) service=query
Sep 19 15:09:28 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:09:27 +0000] "POST /query?chunked=true&db=greenbean_dl&epoch=ns&q=SELECT+mean%28p%29+AS+meanp%2C+count%28p%29+AS+countp+FROM+%28SELECT+P51%2BP55+AS+p
Sep 19 15:09:38 devserver influxd[45661]: [I] 2017-09-19T15:09:38Z SELECT p FROM (SELECT P51 + P55 + P57 AS p FROM greenbean_dl.autogen.L11) service=query
Sep 19 15:10:12 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:10:12 +0000] "GET /ping HTTP/1.1" 204 0 "-" "InfluxDBShell/1.3.5" a282518e-9d4c-11e7-8007-000000000000 21
Sep 19 15:10:15 devserver influxd[45661]: [I] 2017-09-19T15:10:15Z SHOW QUERIES service=query
Sep 19 15:10:15 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:10:15 +0000] "POST /query?chunked=true&db=&epoch=ns&q=show+queries HTTP/1.1" 200 211 "-" "InfluxDBShell/1.3.5" a40b0b4c-9d4c-11e7-8008-000000000000 7
Sep 19 15:10:22 devserver influxd[45661]: [I] 2017-09-19T15:10:22Z KILL QUERY 5 service=query
Sep 19 15:10:22 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:10:22 +0000] "POST /query?chunked=true&db=&epoch=ns&q=kill+query+5 HTTP/1.1" 200 67 "-" "InfluxDBShell/1.3.5" a81a9319-9d4c-11e7-8009-000000000000 57
Sep 19 15:10:34 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:10:34 +0000] "POST /query?chunked=true&db=&epoch=ns&q=SELECT+mean%28p%29+AS+meanp%2C+count%28p%29+AS+countp+FROM+%28SELECT+P51+%2B+P55+%2B+P57+AS+p+F
Sep 19 15:10:48 devserver influxd[45661]: [I] 2017-09-19T15:10:48Z SHOW DATABASES service=query
Sep 19 15:10:48 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:10:48 +0000] "POST /query?db=&epoch=ns&q=SHOW+DATABASES HTTP/1.1" 200 170 "-" "InfluxDBShell/1.3.5" b7bfb677-9d4c-11e7-800b-000000000000 545
Sep 19 15:10:50 devserver influxd[45661]: [I] 2017-09-19T15:10:50Z SELECT mean(p) AS meanp, count(p) AS countp FROM (SELECT P51 + P55 + P57 AS p FROM greenbean_dl.autogen.L11) service=query
Sep 19 15:11:14 devserver influxd[45661]: [httpd] 127.0.0.1 - - [19/Sep/2017:15:11:14 +000

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions