Skip to content

Commit 46f0469

Browse files
authored
Improve some documentation in filter pushdown (#32)
1 parent 542d3f0 commit 46f0469

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

datafusion/physical-plan/src/filter_pushdown.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ impl std::fmt::Display for FilterPushdownPhase {
9090
/// could not handle.
9191
#[derive(Debug, Clone)]
9292
pub enum PredicateSupport {
93+
/// The predicate was successfully pushed down into the child node.
9394
Supported(Arc<dyn PhysicalExpr>),
95+
/// The predicate could not be pushed down into the child node.
9496
Unsupported(Arc<dyn PhysicalExpr>),
9597
}
9698

9799
impl PredicateSupport {
98-
/// Return the wrapped expression, discarding whether it is supported or unsupported.
100+
/// Return the wrapped [`PhysicalExpr`], discarding whether it is supported or unsupported.
99101
pub fn into_inner(self) -> Arc<dyn PhysicalExpr> {
100102
match self {
101103
PredicateSupport::Supported(expr) | PredicateSupport::Unsupported(expr) => {
@@ -113,11 +115,16 @@ impl PredicateSupport {
113115
}
114116
}
115117

116-
/// Discriminant for the result of pushing down a filter into a child node.
118+
/// Used by [`FilterPushdownPropagation`] and [`PredicateSupport`] to
119+
/// communicate the result of attempting to push down a filter into a child
120+
/// node.
121+
///
117122
/// This is the same as [`PredicateSupport`], but without the wrapped expression.
118123
#[derive(Debug, Clone, Copy)]
119124
pub enum PredicateSupportDiscriminant {
125+
/// The predicate was successfully pushed down into the child node.
120126
Supported,
127+
/// The predicate could not be pushed down into the child node.
121128
Unsupported,
122129
}
123130

@@ -202,6 +209,7 @@ impl ChildFilterPushdownResult {
202209
}
203210

204211
/// The result of pushing down filters into a child node.
212+
///
205213
/// This is the result provided to nodes in [`ExecutionPlan::handle_child_pushdown_result`].
206214
/// Nodes process this result and convert it into a [`FilterPushdownPropagation`]
207215
/// that is returned to their parent.
@@ -222,17 +230,20 @@ pub struct ChildPushdownResult {
222230
pub self_filters: Vec<Vec<PredicateSupport>>,
223231
}
224232

225-
/// The result of pushing down filters into a node that it returns to its parent.
226-
/// This is what nodes return from [`ExecutionPlan::handle_child_pushdown_result`] to communicate
233+
/// The result of pushing down filters into a node.
234+
///
235+
/// Returned from [`ExecutionPlan::handle_child_pushdown_result`] to communicate
227236
/// to the optimizer:
228237
///
229-
/// 1. What to do with any parent filters that were not completely handled by the children.
238+
/// 1. What to do with any parent filters that were could not be pushed down into the children.
230239
/// 2. If the node needs to be replaced in the execution plan with a new node or not.
231240
///
232241
/// [`ExecutionPlan::handle_child_pushdown_result`]: crate::ExecutionPlan::handle_child_pushdown_result
233242
#[derive(Debug, Clone)]
234243
pub struct FilterPushdownPropagation<T> {
244+
/// What filters were pushed into the parent node.
235245
pub filters: Vec<PredicateSupportDiscriminant>,
246+
/// The updated node, if it was updated during pushdown
236247
pub updated_node: Option<T>,
237248
}
238249

0 commit comments

Comments
 (0)