Class AndOrComponent
- java.lang.Object
-
- com.apple.foundationdb.record.query.expressions.AndOrComponent
-
- All Implemented Interfaces:
PlanHashable
,ComponentWithChildren
,QueryComponent
- Direct Known Subclasses:
AndComponent
,OrComponent
@API(INTERNAL) public abstract class AndOrComponent extends Object implements ComponentWithChildren
The common base class for BooleanAnd
andOr
query components.
-
-
Constructor Summary
Constructors Constructor Description AndOrComponent(List<QueryComponent> operands)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <M extends Message>
BooleanevalMessage(FDBRecordStoreBase<M> store, EvaluationContext context, FDBRecord<M> record, Message message)
Return whether or not the given record matches this component.<M extends Message>
CompletableFuture<Boolean>evalMessageAsync(FDBRecordStoreBase<M> store, EvaluationContext context, FDBRecord<M> record, Message message)
Asynchronous version ofevalMessage
.List<QueryComponent>
getChildren()
Children for this component, at least 2 of them.boolean
isAsync()
Get whether this component is asynchronous.protected abstract boolean
isOr()
protected List<QueryPredicate>
normalizeChildrenForPlanner(Source rootSource, List<String> fieldNamePrefix)
void
validate(Descriptors.Descriptor descriptor)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.apple.foundationdb.record.query.expressions.ComponentWithChildren
getChildren, withOtherChildren
-
Methods inherited from interface com.apple.foundationdb.record.PlanHashable
planHash
-
Methods inherited from interface com.apple.foundationdb.record.query.expressions.QueryComponent
eval, evalAsync, normalizeForPlanner, normalizeForPlanner, validate
-
-
-
-
Constructor Detail
-
AndOrComponent
public AndOrComponent(@Nonnull List<QueryComponent> operands)
-
-
Method Detail
-
isOr
protected abstract boolean isOr()
-
evalMessage
@Nullable public <M extends Message> Boolean evalMessage(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable FDBRecord<M> record, @Nullable Message message)
Description copied from interface:QueryComponent
Return whether or not the given record matches this component. The message might be the Protobuf form of a record or a piece of that record. If the key expression is meaningful against a subrecord, it should evaluate against the message. Otherwise, it should evaluate against the record and ignore what part of that record is being considered. There should not be any reason to call this method outside of the implementation of anotherevalMessage
. Under ordinary circumstances, ifrecord
isnull
, thenmessage
will benull
. Otherwise,message
will berecord.getRecord()
or some submessage of that, possiblynull
if the corresponding field is missing.- Specified by:
evalMessage
in interfaceQueryComponent
- Type Parameters:
M
- the type of record- Parameters:
store
- the record store from which the record camecontext
- context for bound expressionsrecord
- the recordmessage
- the Protobuf message to evaluate against- Returns:
- true/false/null, true if the given record should be included in results, false if it should not, and null if this component cannot determine whether it should be included or not
- See Also:
QueryComponent.eval(com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase<M>, com.apple.foundationdb.record.EvaluationContext, com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
-
evalMessageAsync
@Nonnull public <M extends Message> CompletableFuture<Boolean> evalMessageAsync(@Nonnull FDBRecordStoreBase<M> store, @Nonnull EvaluationContext context, @Nullable FDBRecord<M> record, @Nullable Message message)
Description copied from interface:QueryComponent
Asynchronous version ofevalMessage
.- Specified by:
evalMessageAsync
in interfaceQueryComponent
- Type Parameters:
M
- the type of record- Parameters:
store
- the record store from which the record camecontext
- context for bound expressionsrecord
- the recordmessage
- the Protobuf message to evaluate against- Returns:
- a future that completes with whether the record should be included in the query result
- See Also:
QueryComponent.eval(com.apple.foundationdb.record.provider.foundationdb.FDBRecordStoreBase<M>, com.apple.foundationdb.record.EvaluationContext, com.apple.foundationdb.record.provider.foundationdb.FDBRecord<M>)
-
isAsync
public boolean isAsync()
Description copied from interface:QueryComponent
Get whether this component is asynchronous.- Specified by:
isAsync
in interfaceQueryComponent
- Returns:
true
if this component is better executed asynchronously
-
normalizeChildrenForPlanner
@Nonnull protected List<QueryPredicate> normalizeChildrenForPlanner(@Nonnull Source rootSource, @Nonnull List<String> fieldNamePrefix)
-
validate
public void validate(@Nonnull Descriptors.Descriptor descriptor)
-
getChildren
@Nonnull public List<QueryComponent> getChildren()
Children for this component, at least 2 of them.- Returns:
- the children of this component
-
-