You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/05/06 20:21:32 UTC

[GitHub] [incubator-druid] pdeva commented on issue #7584: Cant refer to variables declared inside sql statements for post aggregations

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org