Skip to content

InferFiltersFromConstraints Logical Optimization Rule

InferFiltersFromConstraints is a catalyst/[Catalyst rule] for transforming[logical plans] (i.e. Rule[LogicalPlan]).

[[apply]] When catalyst/[executed], InferFiltersFromConstraints simply <> when spark.sql.constraintPropagation.enabled configuration property is enabled.

InferFiltersFromConstraints is a part of the Infer Filters once-executed rule batch of the base Logical Optimizer.

=== [[inferFilters]] inferFilters Internal Method

[source, scala]

inferFilters( plan: LogicalPlan): LogicalPlan

inferFilters supports <> and <> logical operators.

[[inferFilters-Filter]] For Filter logical operators, inferFilters...FIXME

[[inferFilters-Join]] For[Join] logical operators, inferFilters branches off per the join type:

  • For InnerLike and LeftSemi...FIXME

  • For RightOuter...FIXME

  • For LeftOuter and LeftAnti, inferFilters <> and then replaces the right join operator with <>

NOTE: inferFilters is used when InferFiltersFromConstraints is <>.

=== [[getAllConstraints]] getAllConstraints Internal Method

[source, scala]

getAllConstraints( left: LogicalPlan, right: LogicalPlan, conditionOpt: Option[Expression]): Set[Expression]


NOTE: getAllConstraints is used when...FIXME

=== [[inferNewFilter]] Adding Filter -- inferNewFilter Internal Method

[source, scala]

inferNewFilter( plan: LogicalPlan, constraints: Set[Expression]): LogicalPlan


NOTE: inferNewFilter is used when...FIXME