ankitsultana opened a new pull request, #16551:
URL: https://github.com/apache/pinot/pull/16551

   ### Summary
   
   Minor improvement to pushdown collation from the enclosing Exchange to the 
Lite Mode generated Sort.
   
   This is good for queries like the following. Without this patch the 
generated Sort only has a fetch and no collation.
   
   ```
   SET useMultistageEngine = true;
   SET usePhysicalOptimizer = true;
   SET useLiteMode = true;
   
   EXPLAIN PLAN FOR WITH ordered_events AS (
     SELECT 
       cityName,
       tripAmount,
       ROW_NUMBER() OVER (
         ORDER BY ts DESC
       ) as row_num
     FROM userFactEvents
   ),
   filtered_events AS (
     SELECT 
       *
     FROM ordered_events
     WHERE row_num < 1000
   )
   SELECT 
     cityName,
     SUM(tripAmount) as cityTotal
   FROM filtered_events
   GROUP BY cityName
   ```
   
   The plan now for this query is:
   
   ```
   Execution Plan
   PhysicalAggregate(group=[{0}], agg#0=[$SUM0($1)], aggType=[DIRECT])
     PhysicalFilter(condition=[<($3, 1000)])
       PhysicalWindow(window#0=[window(order by [2 DESC] rows between UNBOUNDED 
PRECEDING and CURRENT ROW aggs [ROW_NUMBER()])])
         PhysicalExchange(exchangeStrategy=[SINGLETON_EXCHANGE], collation=[[2 
DESC]])
           PhysicalSort(fetch=[100000])
             PhysicalProject(cityName=[$3], tripAmount=[$7], ts=[$9])
               PhysicalTableScan(table=[[default, userFactEvents]])
   ```
   
   ### Test Plan
   
   Added a UT and also verified on Quickstart.


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