T
- the type of planner expression that is contained in this reference@API(value=EXPERIMENTAL) public class GroupExpressionRef<T extends RelationalExpression> extends Object implements ExpressionRef<T>
RelationalExpression
s that belong to
the same equivalence class.
The memo data structure can compactly represent a large set of similar RelationalExpression
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, wait, wait, wait
bindTo
@Nonnull public T get()
ExpressionRef
get
in interface ExpressionRef<T extends RelationalExpression>
public void insert(@Nonnull T newValue)
insert
in interface ExpressionRef<T extends RelationalExpression>
public void insertAll(@Nonnull GroupExpressionRef<T> newValues)
public boolean containsAllInMemo(@Nonnull ExpressionRef<? extends RelationalExpression> otherRef)
containsAllInMemo
in interface ExpressionRef<T extends RelationalExpression>
public boolean containsInMemo(@Nonnull RelationalExpression expression)
public void clear()
public void setExplored()
public boolean isExplored()
@Nonnull public RelationalExpressionPointerSet<T> getMembers()
getMembers
in interface ExpressionRef<T extends RelationalExpression>
@Nonnull public ExpressionRef<T> getNewRefWith(@Nonnull T expression)
getNewRefWith
in interface ExpressionRef<T extends RelationalExpression>
@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 RelationalExpression>
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 RelationalExpression>
@Nonnull public <U extends RelationalExpression> ExpressionRef<U> map(@Nonnull Function<T,U> func)
map
in interface ExpressionRef<T extends RelationalExpression>
@Nullable public <U extends RelationalExpression> ExpressionRef<U> flatMapNullable(@Nonnull Function<T,ExpressionRef<U>> nullableFunc)
flatMapNullable
in interface ExpressionRef<T extends RelationalExpression>
public static <T extends RelationalExpression> GroupExpressionRef<T> of(@Nonnull T expression)
public static <T extends RelationalExpression> GroupExpressionRef<T> of(@Nonnull T... expressions)
public static <T extends RelationalExpression> GroupExpressionRef<T> from(@Nonnull Collection<T> expressions)