Class PushDownFilterAndLimitIntoUnionAll


public class PushDownFilterAndLimitIntoUnionAll extends OptimizerRules.ParameterizedOptimizerRule<LogicalPlan,LogicalOptimizerContext>
Push down filters that can be evaluated by the UnionAll branch to each branch, and below Subquery, so that the filters can be pushed down further to the data source when possible. Filters that cannot be pushed down remain above the UnionAll. This rule applies for certain patterns of UnionAll branches. The branches of a UnionAll/Fork plan has a similar pattern, Fork adds EsqlProject, an optional Eval and an implicit Limit on top of each branch. However UnionAll branches do not have the implicit Limit appended to each branch, this is difference between Fork and UnionAll. In case there is mismatched data types on the same field across different UnionAll branches, a ConvertFunction could also be added in the optional Eval. If the patterns of the UnionAll branches do not match the following expected patterns, the rule is not applied. Project Eval (optional) - added when the output of each UnionAll branch are not exactly the same EsRelation or Project Eval (optional) Subquery or Subquery - CombineProjections may remove the EsqlProject on top of the subquery