@API(value=INTERNAL) public abstract class BaseField extends Object implements PlanHashable, QueryComponent
QueryComponent
s that involve predicates on one particular record field,
as specified by the fieldName
member.Modifier | Constructor and Description |
---|---|
protected |
BaseField(String fieldName) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
asNestedWith, eval, evalAsync, evalMessage, evalMessageAsync, isAsync, validate
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHashUnordered, stringHashUnordered
acceptPropertyVisitor, bindTo, equalsWithoutChildren, getPlannerExpressionChildren
@Nonnull protected Descriptors.FieldDescriptor findFieldDescriptor(@Nonnull MessageOrBuilder message)
@Nullable protected Object getFieldValue(@Nullable MessageOrBuilder message)
@Nonnull protected Descriptors.FieldDescriptor validateFieldExistence(@Nonnull Descriptors.Descriptor descriptor)
protected void requirePrimitiveField(@Nonnull Descriptors.FieldDescriptor field)
protected void requireMessageField(@Nonnull Descriptors.FieldDescriptor field)
protected void requireScalarField(@Nonnull Descriptors.FieldDescriptor field)
@Nullable @API(value=EXPERIMENTAL) public ExpressionRef<QueryComponent> asUnnestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<QueryComponent> thisRef)
QueryComponent
PlannerExpression
tree rooted at this QueryComponent
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 QueryComponent.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 component is the predicate field("b).equals(3)
and the nestedContext
is
built around field("a")
, then this method would return a reference containing
the predicate field("a").matches(field("b").equals(3))
.
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 QueryComponent
nestedContext
- a context describing the field to use for unnestingthisRef
- the reference that contains this query componentpublic int planHash()
PlanHashable
hashCode
, but with the additional guarantee that is is stable across JVMs.planHash
in interface PlanHashable
@Nonnull @API(value=EXPERIMENTAL) public static ExpressionRef<QueryComponent> unnestedWith(@Nonnull NestedContext nestedContext, @Nonnull ExpressionRef<QueryComponent> thisRef)