Dandandan commented on code in PR #15697: URL: https://github.com/apache/datafusion/pull/15697#discussion_r2041118282
########## datafusion/physical-plan/src/topk/mod.rs: ########## @@ -202,24 +204,93 @@ impl TopK { }) .collect::<Result<Vec<_>>>()?; + // selected indices + let mut selected_rows = None; + + // If the heap doesn't have k elements yet, we can't create thresholds + match self.heap.max() { + Some(max_row) => { + // Get the batch that contains the max row Review Comment: Took a bit of code from @adriangb -- 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