Skip to content

Commit d8078f8

Browse files
committed
Pass filter pushdown through projections
1 parent 2ae30af commit d8078f8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

datafusion/physical-plan/src/projection.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ use super::{
3333
SendableRecordBatchStream, Statistics,
3434
};
3535
use crate::execution_plan::CardinalityEffect;
36+
use crate::filter_pushdown::{
37+
ChildPushdownResult, FilterDescription, FilterPushdownPhase,
38+
FilterPushdownPropagation,
39+
};
3640
use crate::joins::utils::{ColumnIndex, JoinFilter, JoinOn, JoinOnRef};
3741
use crate::{ColumnStatistics, DisplayFormatType, ExecutionPlan, PhysicalExpr};
3842

3943
use arrow::datatypes::{Field, Schema, SchemaRef};
4044
use arrow::record_batch::{RecordBatch, RecordBatchOptions};
45+
use datafusion_common::config::ConfigOptions;
4146
use datafusion_common::stats::Precision;
4247
use datafusion_common::tree_node::{
4348
Transformed, TransformedResult, TreeNode, TreeNodeRecursion,
@@ -273,6 +278,24 @@ impl ExecutionPlan for ProjectionExec {
273278
Ok(Some(Arc::new(projection.clone())))
274279
}
275280
}
281+
282+
fn gather_filters_for_pushdown(
283+
&self,
284+
_phase: FilterPushdownPhase,
285+
parent_filters: Vec<Arc<dyn PhysicalExpr>>,
286+
_config: &ConfigOptions,
287+
) -> Result<FilterDescription> {
288+
FilterDescription::from_children(parent_filters, &self.children())
289+
}
290+
291+
fn handle_child_pushdown_result(
292+
&self,
293+
_phase: FilterPushdownPhase,
294+
child_pushdown_result: ChildPushdownResult,
295+
_config: &ConfigOptions,
296+
) -> Result<FilterPushdownPropagation<Arc<dyn ExecutionPlan>>> {
297+
Ok(FilterPushdownPropagation::if_all(child_pushdown_result))
298+
}
276299
}
277300

278301
fn stats_projection(

0 commit comments

Comments
 (0)