jon-wei commented on issue #7584: Cant refer to variables declared inside sql statements for post aggregations URL: https://github.com/apache/incubator-druid/issues/7584#issuecomment-489768496 This example: ``` select count(*), dataSource AS s from druid_rules group by s; ``` is not the same type of query as ``` SELECT "cluster", sum ("mem_limit") as memTotal, sum ("mem_used") as memUsed, (memUsed*100.0/memTotal) as pct /*this causes problems*/ FROM "metrics" WHERE "__time" >= TIMESTAMP '2019-04-30 20:17:46' AND "__time" < TIMESTAMP '2019-04-30 20:17:48' group by "cluster" ``` See the following: ``` mysql> select count(*), SUM(partitioned) as psum, (psum*100.0) as psumhundred, dataSource AS s from druid_segments group by s; ERROR 1054 (42S22): Unknown column 'psum' in 'field list' ``` ``` mysql> select count(*), SUM(partitioned) as psum, (SUM(partitioned)*100.0) as psumhundred, dataSource AS s from druid_segments group by s; +----------+------+-------------+------------+ | count(*) | psum | psumhundred | s | +----------+------+-------------+------------+ | 1 | 1 | 100.0 | wikipedia | | 44 | 44 | 4400.0 | wikipedia2 | +----------+------+-------------+------------+ 2 rows in set (0.00 sec) ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
