Dandandan commented on code in PR #2218:
URL: https://github.com/apache/arrow-datafusion/pull/2218#discussion_r848818818
##########
datafusion/physical-expr/src/physical_expr.rs:
##########
@@ -51,23 +49,21 @@ pub trait PhysicalExpr: Send + Sync + Display + Debug {
batch: &RecordBatch,
selection: &BooleanArray,
) -> Result<ColumnarValue> {
- if selection.iter().all(|b| b == Some(true)) {
+ let filter = match selection.null_count() {
+ 0 => BooleanArray::from(selection.data().clone()),
+ _ => prep_null_mask_filter(selection),
+ };
+
+ let filter_count = filter
+ .values()
+ .count_set_bits_offset(selection.offset(), selection.len());
+
+ if filter_count == selection.len() {
return self.evaluate(batch);
Review Comment:
See comment. The fasth path avoids calling `scatter` when the `selection`
array is all-true. I reused some code from upstream, as it is not public yet.
In theory, we could re-use the filter count calculation, but we can't
currently wire them together.
I am also OK with removing this path, for making the code a bit simpler.
--
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]