Class RemoveSubPlansWithEmptyResults
java.lang.Object
se.liu.ida.hefquin.engine.queryproc.impl.loptimizer.heuristics.RemoveSubPlansWithEmptyResults
- All Implemented Interfaces:
HeuristicForLogicalOptimization
public class RemoveSubPlansWithEmptyResults
extends Object
implements HeuristicForLogicalOptimization
Removes every subplan that is guaranteed to produce an empty result
according to the cardinality estimate that is determined for it. In
particular, a subplan is removed if it has a cardinality estimate of
0 with the quality score being
QueryPlanProperty.Quality.ACCURATE. The subplans
are removed in a top-down manner (i.e., trying to remove bigger subplans
first).
The heuristic performs a recursive traversal of the logical plan and simplifies the plan based on emptiness information:
-
If the overall plan itself is provably empty, it is replaced by
LogicalPlanWithoutResult. - For union and multiway union operators, empty subplans are removed. If exactly one subplan remains, the union operator is removed and replaced by that subplan.
- For left join operators, if the right subplan is empty, the left join is removed and replaced by its left subplan.
- For all other operators, empty subplans are not removed individually. Instead, emptiness is propagated via cardinality estimates, allowing higher-level simplifications when possible.
CardinalityEstimator.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionprotected LogicalPlan_apply(LogicalPlan inputPlan) apply(LogicalPlan inputPlan) Applies this heuristics to the given plan and returns the resulting, potentially rewritten plan.protected booleanisProvablyEmpty(LogicalPlan plan) Returnstrueif, according to the cardinality estimate that has been determined for the given plan, the plan is guaranteed to produce an empty result.
-
Field Details
-
cardEst
-
-
Constructor Details
-
RemoveSubPlansWithEmptyResults
-
RemoveSubPlansWithEmptyResults
-
-
Method Details
-
apply
Description copied from interface:HeuristicForLogicalOptimizationApplies this heuristics to the given plan and returns the resulting, potentially rewritten plan.- Specified by:
applyin interfaceHeuristicForLogicalOptimization
-
_apply
-
isProvablyEmpty
Returnstrueif, according to the cardinality estimate that has been determined for the given plan, the plan is guaranteed to produce an empty result.
-