You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/12 19:36:38 UTC

[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #2218: Use `filter` (filter_record_batch) instead of `take` to avoid using indices

tustvold commented on code in PR #2218:
URL: https://github.com/apache/arrow-datafusion/pull/2218#discussion_r848801910


##########
datafusion/physical-expr/src/physical_expr.rs:
##########
@@ -51,23 +47,15 @@ pub trait PhysicalExpr: Send + Sync + Display + Debug {
         batch: &RecordBatch,
         selection: &BooleanArray,
     ) -> Result<ColumnarValue> {
-        if selection.iter().all(|b| b == Some(true)) {
+        let filter_count = selection

Review Comment:
   The upstream already performs this optimisation, see [here](https://github.com/apache/arrow-rs/blob/master/arrow/src/compute/kernels/filter.rs#L403) and so you can probably elide counting the bits again.



-- 
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@arrow.apache.org

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