Skip to content

Commit

Permalink
Remove clone
Browse files Browse the repository at this point in the history
  • Loading branch information
Dandandan committed Dec 1, 2023
1 parent 189ca07 commit e39926a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions datafusion/physical-plan/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,18 @@ struct FilterExecStream {
}

pub(crate) fn batch_filter(
batch: &RecordBatch,
batch: RecordBatch,
predicate: &Arc<dyn PhysicalExpr>,
projection: &Option<Vec<usize>>,
) -> Result<RecordBatch> {
predicate
.evaluate(batch)
.evaluate(&batch)
.and_then(|v| v.into_array(batch.num_rows()))
.and_then(|array| {
//load just the columns requested
let batch = match projection.as_ref() {
Some(columns) => batch.project(columns)?,
None => batch.clone(),
None => batch,
};
Ok(as_boolean_array(&array)?)
// apply filter array to record batch
Expand All @@ -342,7 +342,7 @@ impl Stream for FilterExecStream {
let timer: crate::metrics::ScopedTimerGuard<'_> =
self.baseline_metrics.elapsed_compute().timer();
let filtered_batch =
batch_filter(&batch, &self.predicate, &self.projection)?;
batch_filter(batch, &self.predicate, &self.projection)?;
// skip entirely filtered batches
if filtered_batch.num_rows() == 0 {
continue;
Expand Down

0 comments on commit e39926a

Please sign in to comment.