@API(value=INTERNAL) public abstract class BaseNestedField extends BaseField implements ComponentWithSingleChild
QueryComponent
s that represent a query of a nested record type.Modifier and Type | Field and Description |
---|---|
protected ExpressionRef<QueryComponent> |
childComponent |
Constructor and Description |
---|
BaseNestedField(String fieldName,
ExpressionRef<QueryComponent> childComponent) |
Modifier and Type | Method and Description |
---|---|
ExpressionRef<QueryComponent> |
asNestedWith(NestedContext nestedContext,
ExpressionRef<QueryComponent> thisRef)
Produce an exactly equivalent version of the
PlannerExpression tree rooted at this QueryComponent
as if all operations were nested inside the given NestedContext . |
QueryComponent |
getChild() |
Iterator<? extends ExpressionRef<? extends PlannerExpression>> |
getPlannerExpressionChildren()
Return an iterator of references to the children of this planner expression.
|
boolean |
isAsync()
Get whether this component is asynchronous.
|
abstract QueryComponent |
withOtherChild(QueryComponent newChild) |
asUnnestedWith, equals, findFieldDescriptor, getFieldName, getFieldValue, getName, hashCode, planHash, requireMessageField, requirePrimitiveField, requireScalarField, unnestedWith, validateFieldExistence
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
asUnnestedWith, eval, evalAsync, evalMessage, evalMessageAsync, validate
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHash, planHashUnordered, stringHashUnordered
acceptPropertyVisitor, bindTo, equalsWithoutChildren
@Nonnull protected final ExpressionRef<QueryComponent> childComponent
public BaseNestedField(String fieldName, @Nonnull ExpressionRef<QueryComponent> childComponent)
@Nonnull public QueryComponent getChild()
getChild
in interface ComponentWithSingleChild
public abstract QueryComponent withOtherChild(QueryComponent newChild)
withOtherChild
in interface ComponentWithSingleChild
@Nonnull @API(value=EXPERIMENTAL) 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
@Nullable @API(value=EXPERIMENTAL) public ExpressionRef<QueryComponent> asNestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<QueryComponent> thisRef)
QueryComponent
PlannerExpression
tree rooted at this QueryComponent
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 QueryComponent.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 component is the predicate field("a").matches(field("b).equals(3))
and the
nestedContext
is built around field("a")
, then this method would return a reference containing
the predicate field("b").equals(3)
.
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 QueryComponent
nestedContext
- a context describing the field to use for nestingthisRef
- the reference that contains this query componentpublic boolean isAsync()
QueryComponent
isAsync
in interface QueryComponent
true
if this component is better executed asynchronously