599166320 commented on PR #15181:
URL: https://github.com/apache/druid/pull/15181#issuecomment-1799253982

   @cryptoe According to your description, are you concerned about a sorting 
like the one below?
   ```
   SELECT
     COUNT(*) c,
     regionName
   FROM wikipedia
   GROUP BY regionName
   ORDER BY regionName, c DESC
   LIMIT 10
   
   ```
   In fact, when a query like this is forwarded from one broker to another 
broker in a cluster, the `LIMIT 10` part is removed. It will be transformed 
into a `native query `similar to the one below:
   ```
   {
       "queryType": "groupBy",
       "dataSource":
       {
           "type": "table",
           "name": "wikipedia"
       },
       "intervals":
       {
           "type": "intervals",
           "intervals":
           [
               "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
           ]
       },
       "granularity":
       {
           "type": "all"
       },
       "dimensions":
       [
           {
               "type": "default",
               "dimension": "regionName",
               "outputName": "d0",
               "outputType": "STRING"
           }
       ],
       "aggregations":
       [
           {
               "type": "count",
               "name": "a0"
           }
       ],
       "limitSpec":
       {
           "type": "NoopLimitSpec"
       },
       "context":
       {
           "applyLimitPushDown": false,
           "defaultTimeout": 300000,
           "federatedClusterBrokers": "",
           "finalize": false,
           "fudgeTimestamp": "-4611686018427387904",
           "groupByOutermost": false,
           "groupByStrategy": "v2",
           "maxQueuedBytes": 5242880,
           "maxScatterGatherBytes": 9223372036854775807,
           "queryFailTime": 1699369214285,
           "queryId": "605a751b-f0ee-43fe-a754-b702035622df",
           "resultAsArray": true,
           "sqlQueryId": "e8bed46a-f2de-4fc3-89c6-febfe048debc",
           "timeout": 29981
       }
   }
   
   ```
   So, you don't need to worry about this sorting issue.
   


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