@API(value=EXPERIMENTAL) public interface PlannerExpression extends Bindable
ExpressionRef
.
Deciding whether certain fields constitute "node information" (and should therefore be a regular field) or
"hierarchical information" (and therefore should not be) is subtle and more of an art than a science. There are two
reasonable tests that can help make this decision:
RecordQueryIndexPlan
has only regular fields, including the
index name and the comparisons to use when scanning it.
Applying the first rule, it wouldn't really make sense to match the index name or the comparisons being performed on
their own: they're what define an index scan, after all!
Applying the second rule, they're relatively small immutable objects that don't need to be memoized.
In contrast, RecordQueryFilterPlan
has no regular fields.
A filter plan has two important fields: the Query.Component
used for the filter and a child plan that
provides input. Both of these might be matched by rules directly, in order to optimize them without regard for the
fact that there's a filter. Similarly, they should both be memoized separately, since there might be many possible
implementations of each.Modifier and Type | Method and Description |
---|---|
default <U> U |
acceptPropertyVisitor(PlannerProperty<U> visitor)
Apply the given property visitor to this planner expression and its children.
|
default Stream<PlannerBindings> |
bindTo(ExpressionMatcher<? extends Bindable> binding)
Matches a matcher expression to an expression tree rooted at this node, adding to some existing bindings.
|
boolean |
equalsWithoutChildren(PlannerExpression otherExpression) |
Iterator<? extends ExpressionRef<? extends PlannerExpression>> |
getPlannerExpressionChildren()
Return an iterator of references to the children of this planner expression.
|
@Nonnull default Stream<PlannerBindings> bindTo(@Nonnull ExpressionMatcher<? extends Bindable> binding)
@Nonnull Iterator<? extends ExpressionRef<? extends PlannerExpression>> getPlannerExpressionChildren()
Collections.emptyIterator()
is returned. The returned iterator should
be treated as an immutable object and may throw an exception if Iterator.remove()
is called.
The iterator must return its elements in a consistent order.boolean equalsWithoutChildren(@Nonnull PlannerExpression otherExpression)
@Nullable default <U> U acceptPropertyVisitor(@Nonnull PlannerProperty<U> visitor)
null
if
PlannerProperty.shouldVisit(PlannerExpression)
called on this expression returns false
.U
- the type of the evaluated propertyvisitor
- a PlannerProperty
visitor to evaluate