@API(value=EXPERIMENTAL) public class LogicalFilterExpression extends Object implements RelationalExpressionWithChildren
for the fallback implementation
Constructor and Description |
---|
LogicalFilterExpression(ExpressionRef<QueryComponent> filter,
ExpressionRef<RelationalPlannerExpression> inner) |
LogicalFilterExpression(QueryComponent filter,
RelationalPlannerExpression inner) |
Modifier and Type | Method and Description |
---|---|
ExpressionRef<RelationalPlannerExpression> |
asNestedWith(NestedContext nestedContext,
ExpressionRef<RelationalPlannerExpression> thisRef)
Produce an exactly equivalent version of the
PlannerExpression tree rooted at this
RelationalPlannerExpression as if all operations were nested inside the given NestedContext . |
ExpressionRef<RelationalPlannerExpression> |
asUnnestedWith(NestedContext nestedContext,
ExpressionRef<RelationalPlannerExpression> thisRef)
Produce an exactly equivalent version of the
PlannerExpression tree rooted at this
RelationalPlannerExpression with all operations placed inside the field given by the NestedContext . |
boolean |
equals(Object o) |
boolean |
equalsWithoutChildren(PlannerExpression otherExpression) |
QueryComponent |
getFilter() |
RelationalPlannerExpression |
getInner() |
Iterator<? extends ExpressionRef<? extends PlannerExpression>> |
getPlannerExpressionChildren()
Return an iterator of references to the children of this planner expression.
|
int |
getRelationalChildCount() |
int |
hashCode() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
fromRecordQuery
acceptPropertyVisitor, bindTo
public LogicalFilterExpression(@Nonnull QueryComponent filter, @Nonnull RelationalPlannerExpression inner)
public LogicalFilterExpression(@Nonnull ExpressionRef<QueryComponent> filter, @Nonnull ExpressionRef<RelationalPlannerExpression> inner)
@Nonnull public Iterator<? extends ExpressionRef<? extends PlannerExpression>> getPlannerExpressionChildren()
PlannerExpression
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.getPlannerExpressionChildren
in interface PlannerExpression
public int getRelationalChildCount()
getRelationalChildCount
in interface RelationalExpressionWithChildren
@Nonnull public QueryComponent getFilter()
@Nonnull public RelationalPlannerExpression getInner()
@Nullable public ExpressionRef<RelationalPlannerExpression> asNestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<RelationalPlannerExpression> thisRef)
RelationalPlannerExpression
PlannerExpression
tree rooted at this
RelationalPlannerExpression
as if all operations were nested inside the given NestedContext
. That
is, transform all predicates, index scans, and other operations to the form that they would have if they were
nested within the field given by the parent field of the given nested context. If it is not possible to produce
such an expression, return null
.
With RelationalPlannerExpression.asUnnestedWith(NestedContext, ExpressionRef)
, this method should obey the contract that, for any
expression
and nestedContext
,
expression.asNestedWith(nestedContext, ref).asUnnestedWith(nestedContext, ref)
is either equal to
expression
(according to the equals()
comparison) or null
.
For example, if this expression is a filter on the predicate field("a").matches(field("b).equals(3))
,
with an inner FullUnorderedScanExpression
, and the nestedContext
is built around
field("a")
, then this method would return a reference containing a logical filter on the predicate
field("b").equals(3
) with an inner FullUnorderedScanExpression
.
The thisRef
parameter has two uses. For some implementations of asNestedWith()
, the expression
does not need to be changed, and so it is more efficient to return the containing reference than to build a
new one. Additionally, it is used to generate a reference of the appropriate type using the
ExpressionRef.getNewRefWith(PlannerExpression)
.
asNestedWith
in interface RelationalPlannerExpression
nestedContext
- a context describing the field to use for nestingthisRef
- the reference that contains this relational planner expression@Nullable public ExpressionRef<RelationalPlannerExpression> asUnnestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<RelationalPlannerExpression> thisRef)
RelationalPlannerExpression
PlannerExpression
tree rooted at this
RelationalPlannerExpression
with all operations placed inside the field given by the NestedContext
.
That is, put all predicates, index scans, and other operations within the given nested field. If it is not possible
to produce such an expression, return null
.
With RelationalPlannerExpression.asNestedWith(NestedContext, ExpressionRef)
, this method should obey the contract that, for any
expression
and nestedContext
,
expression.asNestedWith(nestedContext, ref).asUnnestedWith(nestedContext, ref)
is either equal to
expression
(according to the equals()
comparison) or null
.
For example, if this expression is a logical filter on the predicate field("b).equals(3)
, with an inner
FullUnorderedScanExpression
, and the nestedContext
is built around field("a")
, then this
method would return a reference containing a logical filter on the predicate
field("a").matches(field("b").equals(3))
with an inner FullUnorderedScanExpression
.
The thisRef
parameter has two uses. For some implementations of asUnnestedWith()
, the expression
does not need to be changed, and so it is more efficient to return the containing reference than to build a
new one. Additionally, it is used to generate a reference of the appropriate type using the
ExpressionRef.getNewRefWith(PlannerExpression)
.
asUnnestedWith
in interface RelationalPlannerExpression
nestedContext
- a context describing the field to use for unnestingthisRef
- the reference that contains this expressionpublic boolean equalsWithoutChildren(@Nonnull PlannerExpression otherExpression)
equalsWithoutChildren
in interface PlannerExpression