T
- the type of planner expression that is contained in this reference@API(value=EXPERIMENTAL) public class GroupExpressionRef<T extends PlannerExpression> extends Object implements MutableExpressionRef<T>
PlannerExpression
s that belong to
the same equivalence class.
The memo data structure can compactly represent a large set of similar PlannerExpression
s through
careful memoization. The Cascades "group expression", represented by the GroupExpressionRef
, is the key to
that memoization by sharing optimization work on a sub-expression with other parts of the expression that reference
the same sub-expression.
The reference abstraction is designed to make it difficult for authors of rules to mutate group expressions directly,
which is undefined behavior. Note that a GroupExpressionRef
cannot be "dereferenced" using the get()
method if it contains more than one member. Expressions with more than one member should not be used outside of the
query planner, and get()
should not be used inside the query planner.
ExpressionRef.UngettableReferenceException
Modifier | Constructor and Description |
---|---|
|
GroupExpressionRef() |
protected |
GroupExpressionRef(T expression) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
bindTo
@Nonnull public T get()
ExpressionRef
get
in interface ExpressionRef<T extends PlannerExpression>
public void insert(@Nonnull T newValue)
insert
in interface MutableExpressionRef<T extends PlannerExpression>
public void insertAll(@Nonnull GroupExpressionRef<T> newValues)
public boolean containsAllInMemo(@Nonnull ExpressionRef<? extends PlannerExpression> otherRef)
containsAllInMemo
in interface ExpressionRef<T extends PlannerExpression>
public boolean containsInMemo(@Nonnull PlannerExpression expression)
public void clear()
public void setExplored()
public boolean isExplored()
@Nonnull public PlannerExpressionPointerSet<T> getMembers()
getMembers
in interface ExpressionRef<T extends PlannerExpression>
@Nonnull public ExpressionRef<T> getNewRefWith(@Nonnull T expression)
getNewRefWith
in interface ExpressionRef<T extends PlannerExpression>
@Nonnull public Stream<PlannerBindings> bindWithin(@Nonnull ExpressionMatcher<? extends Bindable> matcher)
ExpressionRef
Stream
API, so as to minimize unnecessary
work.bindWithin
in interface ExpressionRef<T extends PlannerExpression>
matcher
- an expression matcher to match the member(s) of this reference withpublic <U> U acceptPropertyVisitor(@Nonnull PlannerProperty<U> property)
acceptPropertyVisitor
in interface ExpressionRef<T extends PlannerExpression>
@Nonnull public <U extends PlannerExpression> ExpressionRef<U> map(@Nonnull Function<T,U> func)
map
in interface ExpressionRef<T extends PlannerExpression>
@Nullable public <U extends PlannerExpression> ExpressionRef<U> flatMapNullable(@Nonnull Function<T,ExpressionRef<U>> nullableFunc)
flatMapNullable
in interface ExpressionRef<T extends PlannerExpression>
public static <T extends PlannerExpression> GroupExpressionRef<T> of(@Nonnull T expression)
public static <T extends PlannerExpression> GroupExpressionRef<T> of(@Nonnull T... expressions)
public static <T extends PlannerExpression> GroupExpressionRef<T> from(@Nonnull Collection<T> expressions)