Expand description
PushDownFilter applies filters as early as possible
§Precedence: pure extraction projections win
PushDownLeafProjections moves a pure extraction projection towards the
leaves. Such a projection has only __datafusion_extracted_N aliases and
pass-through columns. PushDownFilter moves filters towards the leaves
too. For an adjacent filter and pure extraction projection the two rules
want the opposite order, so they undo each other on every optimizer pass.
Invariant: PushDownFilter yields to a pure extraction projection. A
filter is never moved below such a projection. The extraction projection
stays at the bottom of the plan, next to the scan, and the filter stays
above it.
The reason is that the extraction projection is the node a source absorbs.
A Parquet scan merges it into the file projection and reads only the struct
leaf, which is what the rule exists for. Keeping the filter one node higher
costs nothing at the scan, because PushDownFilter records the predicate in
TableScan::filters in the pass
that runs before the extraction projection exists.
Structs§
- Push
Down Filter - Optimizer rule for pushing (moving) filter expressions down in a plan so they are applied as early as possible.
Functions§
- make_
filter Deprecated - Creates a new LogicalPlan::Filter node.
- replace_
cols_ by_ name - replaces columns by its name on the projection.