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/05 06:41:06 UTC

[GitHub] [incubator-druid] shizhengchao opened a new issue #7592: An question about groupby type SQL query

shizhengchao opened a new issue #7592: An question about groupby type SQL query
URL: https://github.com/apache/incubator-druid/issues/7592
 
 
   How to convert a group by into SQL Query. for example:
   ```json
   {
     "queryType": "groupBy",
     "dataSource": "send_101",
     "granularity": "day",
     "dimensions": ["company_id"],
     "limitSpec": { "type": "default", "limit": 5000, "columns": ["company_id"] },
     "aggregations":[
         {
             "type":"longSum",
             "name":"sendCount",
             "fieldName":"drop_send_count",
             "expression":null
         }
     ],
     "intervals":{
         "type":"intervals",
         "intervals":[
             "2019-05-01T00:00:00.000Z/2019-05-06T00:00:00.001Z"
         ]
     }
   }
   ```
   convert to sql query, is like this?
   ```sql
   SELECT
       FLOOR(__time TO DAY) AS DayTime,
       "company_id",
   	SUM(drop_send_count) AS DropSendCount
   FROM
   	send_101
   WHERE
   	"__time" BETWEEN TIMESTAMP '2019-05-01 00:00:00'
   AND TIMESTAMP '2019-05-06 00:00:00'
   AND dis_lv = 1
   GROUP BY
   	FLOOR(__time TO DAY), "company_id"
   ```
   but, this sql is grouped by two dims。
   EXPLAIN PLAN FOR above the sql,i found the granularity always "all", 
   so how to specify granularity in my groupby type SQL query

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