abhishekagarwal87 commented on issue #13204:
URL: https://github.com/apache/druid/issues/13204#issuecomment-1279666235

   does this seem like the right native plan for this query? (I replaced the 
"countryName" post-aggregator with a virtual column and then used that in the 
subTotalSpec) It generates the right output. We can agree on the native plan 
first and then see how to get to that native plan. 
   
   ```
   {
     "queryType": "groupBy",
     "dataSource": {
       "type": "table",
       "name": "wikipedia"
     },
     "intervals": {
       "type": "intervals",
       "intervals": [
         "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
       ]
     },
     "virtualColumns": [
       {
         "type": "expression",
         "name": "v0",
         "expression": "timestamp_floor(\"__time\",'P1M',null,'UTC')",
         "outputType": "LONG"
       },
       {
         "type": "expression",
         "name": "p0",
         "expression": "'Indonesia'"
       }
     ],
     "filter": {
       "type": "and",
       "fields": [
         {
           "type": "selector",
           "dimension": "cityName",
           "value": "Cilacap"
         },
         {
           "type": "selector",
           "dimension": "countryName",
           "value": "Indonesia"
         }
       ]
     },
     "granularity": {
       "type": "all"
     },
     "dimensions": [
       {
         "type": "default",
         "dimension": "v0",
         "outputName": "d0",
         "outputType": "LONG"
       },
       {
         "type": "default",
         "dimension": "p0",
         "outputName": "d1"
       }
     ],
     "aggregations": [
       {
         "type": "longSum",
         "name": "a0",
         "fieldName": "added"
       }
     ],
     "postAggregations": [
      
     ],
     "limitSpec": {
       "type": "default",
       "columns": [],
       "limit": 1001
     },
     "subtotalsSpec": [
       [
         "d0", "d1"
       ],
       [
         "d0"
       ]
     ],
     "context": {
       "sqlOuterLimit": 1001,
       "sqlQueryId": "bc0e203a-d555-4b22-99d2-74a0794da2b8",
       "timestampResultField": "d0",
       "timestampResultFieldGranularity": "MONTH",
       "timestampResultFieldInOriginalDimensions": 0,
       "useNativeQueryExplain": true
     }
   }
   ```


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to