nrwiersma opened a new issue #8439: Subtotal spec and ordering
URL: https://github.com/apache/incubator-druid/issues/8439
 
 
   ### Description
   
   Currently, when applying ordering on a dimension to a query that has a total 
subtotal spec applied (or any subtotal spec that does not contain the 
dimension) will return an error.
   
   ```
   {
       "queryType": "groupBy",
       "dataSource": "some_awesome_table",
       "granularity": "all",
       "dimensions": [
           "country"
       ],
       "aggregations": [
           {
               "type": "count",
               "name": "count"
           }
       ],
       "subtotalsSpec": [["country"], []],
          "limitSpec": {
                    "type": "default",
                    "limit": 100,
                    "columns": [
                                          {
                   "dimension": "country",
                   "direction": "descending"
               }
                                ]
          },
       "intervals": [
           "2019-06-30T00:00:00Z/2019-06-31T00:00:00Z"
       ],
        "context": {
           "useCache": false,
           "populateCache": false,
           "useResultLevelCache": false,
           "populateResultLevelCache": false
        }
   }
   ```
   
   returns
   
   ```
   {
     "error": "Unknown exception",
     "errorMessage": "Unknown column in order 
clause[OrderByColumnSpec{dimension='country', direction='descending', 
dimensionComparator='lexicographic'}]",
     "errorClass": "org.apache.druid.java.util.common.ISE",
     "host": null
   }
   ```
   
   This is obviously technically correct as the total subtotal does not contain 
the dimension. It would be more useful to allow the ordering in this case, as a 
total will only ever produce 1 record, and therefore can never actually be 
ordered.
   
   ### Motivation
   
   It is fairly common to want to order results and provide totals. In the 
above example, it is not unreasonable to want to provided alphabetical country 
ordering and a total at the same time.
   
   The argument could be made to reduce ordering columns to the subset of 
columns in the the subtotal spec, as long as all ordering columns exists in at 
least 1 subtotal spec or is a metric.
   

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