@API(value=EXPERIMENTAL) public interface RelationalPlannerExpression extends PlannerExpression
PlannerExpression
that represents a stream of records. At all times, the root
expression being planned must be relational. This interface acts as a common tag interface for
RecordQueryPlan
s, which can actually produce a stream of records,
and various logical relational expressions (not yet introduced), which represent an abstract stream of records but can't
be executed directly (such as an unimplemented sort). Other planner expressions such as QueryComponent
and KeyExpression
do not represent streams of records.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 . |
static PlannerExpression |
fromRecordQuery(RecordQuery query) |
acceptPropertyVisitor, bindTo, equalsWithoutChildren, getPlannerExpressionChildren
@Nonnull static PlannerExpression fromRecordQuery(@Nonnull RecordQuery query)
@Nullable @API(value=EXPERIMENTAL) ExpressionRef<RelationalPlannerExpression> asNestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<RelationalPlannerExpression> thisRef)
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 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)
.
nestedContext
- a context describing the field to use for nestingthisRef
- the reference that contains this relational planner expression@Nullable @API(value=EXPERIMENTAL) ExpressionRef<RelationalPlannerExpression> asUnnestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<RelationalPlannerExpression> thisRef)
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 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)
.
nestedContext
- a context describing the field to use for unnestingthisRef
- the reference that contains this expression