geoffreyclaude commented on code in PR #15563: URL: https://github.com/apache/datafusion/pull/15563#discussion_r2030890353
########## datafusion/physical-plan/src/topk/mod.rs: ########## @@ -183,6 +208,86 @@ impl TopK { // update memory reservation self.reservation.try_resize(self.size())?; + + // flag the topK as finished if we know that all + // subsequent batches are guaranteed to be worse than the + // current topK + self.attempt_early_completion(&batch)?; Review Comment: I don't think that's possible as we need to insert the batch into the `heap` to update its max value first. -- 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-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org