adriangb opened a new pull request, #21424:
URL: https://github.com/apache/datafusion/pull/21424

   Allow TopK optimization to work with aggregates even when their natural sort 
order doesn't match the requested ORDER BY direction. The 
GroupedTopKAggregateStream can handle any sort direction via limit_options.
   
   This enables:
   - MIN with ORDER BY DESC (and vice versa)
   - Single-aggregate LIMIT queries to use efficient TopK execution
   - Support for multiple aggregates where one is MIN/MAX
   
   Performance improvement:
   - Single MIN/MAX with LIMIT: ~21% faster (0.57s → 0.47s on 8.7M groups)
   - Removes unnecessary optimizer skip for DESC ordering
   
   Changes:
   - Relax field name matching in filter, remove sort direction check
   - Support Partial mode aggregates in addition to Single/SinglePartitioned
   - Update comments to explain GroupedTopKAggregateStream handles direction


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