public class TypeFilterCountProperty extends Object implements PlannerProperty<Integer>
PlannerExpression
tree, of the number of record
types that are passed by type filters in the tree. Records that are filtered for on more than one type filter are
not de-duplicated. For example, if there are two TypeFilterExpression
s, one that filters for records
of types Type1
or Type2
and one that filters for records of type Type1
, then this property
would evaluate to 3.
This property provides some heuristic sense of how much work is being done by type filters, since unnecessary ones are aggressively pruned by the planner.
Constructor and Description |
---|
TypeFilterCountProperty() |
Modifier and Type | Method and Description |
---|---|
static int |
evaluate(PlannerExpression expression) |
Integer |
evaluateAtExpression(PlannerExpression expression,
List<Integer> childResults)
Evaluate the property at the given expression, using the results of evaluating the property at its children.
|
Integer |
evaluateAtRef(ExpressionRef<? extends PlannerExpression> ref,
List<Integer> memberResults)
Evaluate the property at the given reference, using the results of evaluating the property at its members.
|
boolean |
shouldVisit(ExpressionRef<? extends PlannerExpression> ref)
Return whether the property should visit the subtree rooted at the given expression.
|
boolean |
shouldVisit(PlannerExpression expression)
Return whether the property should visit the subtree rooted at the given expression.
|
public boolean shouldVisit(@Nonnull ExpressionRef<? extends PlannerExpression> ref)
PlannerProperty
shouldVisit()
is called on that node.
If shouldVisit()
returns false
, then PlannerProperty.evaluateAtRef(ExpressionRef, List)
will
not be called on the given expression.shouldVisit
in interface PlannerProperty<Integer>
ref
- the expression reference to visittrue
if the members of ref
should be visited and false
if they should not be visitedpublic boolean shouldVisit(@Nonnull PlannerExpression expression)
PlannerProperty
shouldVisit()
is called on that node.
If shouldVisit()
returns false
, then PlannerProperty.evaluateAtExpression(PlannerExpression, List)
will
not be called on the given expression.shouldVisit
in interface PlannerProperty<Integer>
expression
- the planner expression to visittrue
if the children of expression
should be visited and false
if they should not be visited@Nonnull public Integer evaluateAtExpression(@Nonnull PlannerExpression expression, @Nonnull List<Integer> childResults)
PlannerProperty
evaluateAtExpression()
is called on that node.evaluateAtExpression
in interface PlannerProperty<Integer>
expression
- the cursor to visitchildResults
- the results of the property evaluated at the children of expression
@Nonnull public Integer evaluateAtRef(@Nonnull ExpressionRef<? extends PlannerExpression> ref, @Nonnull List<Integer> memberResults)
PlannerProperty
evaluateAtRef()
is called on that node.evaluateAtRef
in interface PlannerProperty<Integer>
ref
- the expression reference to visitmemberResults
- the results of the property evaluated at the members of ref
public static int evaluate(@Nonnull PlannerExpression expression)