Nishant Bangarwa created CALCITE-1656:
-----------------------------------------

             Summary: Sub-Optimal Druid Query planning - Does not Prune columns 
for DruidQuery 
                 Key: CALCITE-1656
                 URL: https://issues.apache.org/jira/browse/CALCITE-1656
             Project: Calcite
          Issue Type: Bug
          Components: druid
            Reporter: Nishant Bangarwa
            Assignee: Julian Hyde


Consider below query - 
{code}
select "countryName", floor("time" to DAY), cast(count(*) as integer) as c
         from "wiki"
         where floor("time" to DAY) >= '1997-01-01 00:00:00' and          
floor("time" to DAY) < '1997-09-01 00:00:00'
         group by "countryName", floor("time" TO DAY)
         order by c limit 5
{code} 

resulting Druid Query - 
{code}
{
  "queryType": "select",
  "dataSource": "wikiticker",
  "descending": false,
  "intervals": [
    "1900-01-09T00:00:00.000/2992-01-10T00:00:00.000"
  ],
  "dimensions": [
    "channel",
    "cityName",
    "comment",
    "countryIsoCode",
    "countryName",
    "isAnonymous",
    "isMinor",
    "isNew",
    "isRobot",
    "isUnpatrolled",
    "metroCode",
    "namespace",
    "page",
    "regionIsoCode",
    "regionName",
    "user"
  ],
  "metrics": [
    "count",
    "added",
    "deleted",
    "delta",
    "user_unique"
  ],
  "granularity": "all",
  "pagingSpec": {
    "threshold": 16384,
    "fromNext": true
  },
  "context": {
    "druid.query.fetch": false
  }
}
{code} 

Note that the above druid query has extra dimensions which are not required. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to