pdeva 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-489762176
 
 
   @vogievetsky here is an example:
   
   1. MySQL query with `GROUP BY` using variable `s`
   ```sql
   
   select count(*), dataSource AS s
   from druid_rules
   group by s;
   ```
   Works as expected
   
   2. Druid SQL query with `GROUP BY` using variable `gran` :
   ```sql
   SELECT sum ("mem_used") as memUsed, TIME_FLOOR("__time", 'PT2S') as gran
   FROM "metrics" 
   WHERE "__time" >= TIMESTAMP '2019-05-06 19:32:42' AND "__time" < TIMESTAMP 
'2019-05-06 19:32:48'  
   GROUP BY  gran
   ```
   
   Result:
   ```
   Bad Request: Unknown exception: 
org.apache.calcite.runtime.CalciteContextException:  Column 'gran' not found in 
any table
   ```

----------------------------------------------------------------
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]

Reply via email to