You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "haohuaijin (via GitHub)" <gi...@apache.org> on 2026/01/04 14:07:20 UTC

[I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

haohuaijin opened a new issue, #19638:
URL: https://github.com/apache/datafusion/issues/19638

   ### Is your feature request related to a problem or challenge?
   
   current the `GroupedTopKAggregateStream` support two type of query
   ```sql
   select id, max(time) from t group by id order by max(time) desc limit 10
   select id, min(time) from t group by id order by min(time) asc limit 10
   ```
   we have another use case that i find it also can use GroupedTopKAggregateStream to spped up, like below query
   ```sql
   select distinct id from t order by id desc/asc limit 10
   select id from t group by id order by id desc/asc limit 10
   ```
   because If a certain `id = x` is in the global top 10(the second phase of AggregateExec), then `x` must appear in the local top 10(the first phase of AggregateExec) of at least one partition.
   
   ### Describe the solution you'd like
   
   1. modify the `TopKAggregation` optimizer rule to pass the information to AggregateExec
   2. modify `GroupedTopKAggregateStream` to support this case
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

Posted by "GaneshPatil7517 (via GitHub)" <gi...@apache.org>.
GaneshPatil7517 commented on issue #19638:
URL: https://github.com/apache/datafusion/issues/19638#issuecomment-3708907086

   take


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #19638: Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream
URL: https://github.com/apache/datafusion/issues/19638


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

Posted by "nuno-faria (via GitHub)" <gi...@apache.org>.
nuno-faria commented on issue #19638:
URL: https://github.com/apache/datafusion/issues/19638#issuecomment-3709407553

   > hey [@nuno-faria](https://github.com/nuno-faria) Can i work on this....'?
   
   It appears that @haohuaijin is already working on this.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

Posted by "GaneshPatil7517 (via GitHub)" <gi...@apache.org>.
GaneshPatil7517 commented on issue #19638:
URL: https://github.com/apache/datafusion/issues/19638#issuecomment-3709509469

   ok


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

Posted by "GaneshPatil7517 (via GitHub)" <gi...@apache.org>.
GaneshPatil7517 commented on issue #19638:
URL: https://github.com/apache/datafusion/issues/19638#issuecomment-3708936000

   hey @nuno-faria Can i work on this....'?


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Support DISTINCT ORDER BY LIMIT query use GroupedTopKAggregateStream [datafusion]

Posted by "haohuaijin (via GitHub)" <gi...@apache.org>.
haohuaijin commented on issue #19638:
URL: https://github.com/apache/datafusion/issues/19638#issuecomment-3708117313

   take


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org