@API(value=EXPERIMENTAL) public interface QueryPredicate extends Bindable, PlanHashable
SourceEntry
(usually derived from a record).
QueryPredicate
is generally quite similar to QueryComponent
.
However, there is a key difference in how each interface evaluates the predicate against a given record:
QueryComponent
is evaluated on a
FDBRecord
wrapping a Protobuf message.
To evaluate predicates on nested records, a QueryComponent
such as
NestedField
or
OneOfThemWithComponent
will descend into the nested
record.
QueryPredicate
is evaluated on a SourceEntry
, which maps
Source
s to values. The predicate can be evaluated
on a nested record by specifying a complex Source
, such as
RepeatedFieldSource
. All sources are evaluated
to produce a stream of source entries before any predicates are evaluated.
Concretely, the difference between QueryPredicate
s and QueryComponent
s is most easily seen in the
way that multiple predicates on repeated fields can be expressed. Any query predicate anywhere in a tree of
predicates can make use of any source. In contrast, each OneOfThemWithComponent
is a single iteration through the field's repeated values so the values obtained by that iteration are usable only
within that OneOfThemWithComponent
.
Modifier and Type | Method and Description |
---|---|
<M extends Message> |
eval(FDBRecordStoreBase<M> store,
EvaluationContext context,
SourceEntry sourceEntry) |
combineHashes, iterablePlanHash, objectPlanHash, objectsPlanHash, planHash, planHash, planHash, planHashUnordered, stringHashUnordered
@Nullable <M extends Message> Boolean eval(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nonnull SourceEntry sourceEntry)