Class NotComponent
- java.lang.Object
-
- com.apple.foundationdb.record.query.expressions.NotComponent
-
- All Implemented Interfaces:
PlanHashable
,ComponentWithSingleChild
,QueryComponent
@API(MAINTAINED) public class NotComponent extends Object implements ComponentWithSingleChild
AQueryComponent
that is satisfied when its child component is not satisfied. For tri-valued logic, if the child evaluates to unknown /null
,NOT
is still unknown.
-
-
Constructor Summary
Constructors Constructor Description NotComponent(QueryComponent child)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
<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
.QueryComponent
getChild()
Child for this component.int
hashCode()
boolean
isAsync()
Get whether this component is asynchronous.QueryPredicate
normalizeForPlanner(Source source, List<String> fieldNamePrefix)
Convert this query component into an equivalentQueryPredicate
by pushing all information about nested and repeated fields toElement
s inside ofElementPredicate
s.int
planHash()
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.String
toString()
void
validate(Descriptors.Descriptor descriptor)
Validate that the given descriptor is consistent with this component.QueryComponent
withOtherChild(QueryComponent newChild)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.apple.foundationdb.record.query.expressions.QueryComponent
eval, evalAsync, normalizeForPlanner
-
-
-
-
Constructor Detail
-
NotComponent
public NotComponent(@Nonnull QueryComponent child)
-
-
Method Detail
-
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
-
validate
public void validate(@Nonnull Descriptors.Descriptor descriptor)
Description copied from interface:QueryComponent
Validate that the given descriptor is consistent with this component. e.g. it has all the fields defined that this component wants to inspect.- Specified by:
validate
in interfaceQueryComponent
- Parameters:
descriptor
- a record type descriptor, or a submessage descriptor
-
getChild
@Nonnull public QueryComponent getChild()
Child for this component.- Specified by:
getChild
in interfaceComponentWithSingleChild
-
withOtherChild
public QueryComponent withOtherChild(QueryComponent newChild)
- Specified by:
withOtherChild
in interfaceComponentWithSingleChild
-
planHash
public int planHash()
Description copied from interface:PlanHashable
Return a hash similar tohashCode
, but with the additional guarantee that is is stable across JVMs.- Specified by:
planHash
in interfacePlanHashable
- Returns:
- a stable hash code
-
normalizeForPlanner
@Nonnull public QueryPredicate normalizeForPlanner(@Nonnull Source source, @Nonnull List<String> fieldNamePrefix)
Description copied from interface:QueryComponent
Convert this query component into an equivalentQueryPredicate
by pushing all information about nested and repeated fields toElement
s inside ofElementPredicate
s.This normalization process requires tracking some state: the name of a nested field is available only at the relevant
NestedField
, but that information is necessary to construct theElementPredicate
at the leaves of the sub-tree rooted at that nested field. This extra information is tracked in the givenfieldNamePrefix
.- Specified by:
normalizeForPlanner
in interfaceQueryComponent
- Parameters:
source
- the source representing the input stream of the key expressionfieldNamePrefix
- the (non-repeated) field names on the path from the most recent source to this part of the query component- Returns:
- an equivalent query predicate
-
-