adriangb commented on code in PR #21806:
URL: https://github.com/apache/datafusion/pull/21806#discussion_r3164615682
##########
datafusion/physical-plan/src/topk/mod.rs:
##########
@@ -254,11 +254,11 @@ impl TopK {
let num_rows = batch.num_rows();
let array = filtered.into_array(num_rows)?;
let mut filter = array.as_boolean().clone();
- let true_count = filter.true_count();
- if true_count == 0 {
+ if !filter.has_true() {
// nothing to filter, so no need to update
return Ok(());
}
+ let true_count = filter.true_count();
// only update the keys / rows if the filter does not match all rows
if true_count < num_rows {
Review Comment:
Maybe:
```suggestion
// only update the keys / rows if the filter does not match all rows
if filter.null_count() > 0 || filter.has_false() {
```
--
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]