public class Predicate<E> extends AbstractAccessPathOp<E> implements IPredicate<E>
IPredicate.| Modifier and Type | Class and Description |
|---|---|
static interface |
Predicate.Annotations |
DEFAULT_INITIAL_CAPACITY| Constructor and Description |
|---|
Predicate(BOp[] args,
Map<String,Object> annotations)
Required shallow copy constructor.
|
Predicate(BOp[] args,
NV... annotations)
Variable argument version of the shallow constructor.
|
Predicate(IVariableOrConstant<?>[] values,
String relationName,
int partitionId,
boolean optional,
IElementFilter<E> constraint,
IAccessPathExpander<E> expander,
long timestamp) |
Predicate(IVariableOrConstant<?>[] values,
String relationName,
long timestamp)
Simplified ctor (for lex predicates).
|
Predicate(Predicate<E> op)
Constructor required for
com.bigdata.bop.BOpUtility#deepCopy(FilterNode). |
| Modifier and Type | Method and Description |
|---|---|
protected Predicate<E> |
_asBound(IBindingSet bindingSet)
Override any unbound variables for which we were giving bindings.
|
Predicate<E> |
addAccessPathFilter(IFilter filter)
|
Predicate<E> |
addIndexLocalFilter(IFilter filter)
|
Predicate<E> |
asBound(IBindingSet bindingSet)
Fast path for as-bound.
|
Object |
asBound(int index,
IBindingSet bindingSet)
Extract the as bound value from the predicate.
|
Predicate<E> |
asBound(IVariable<?> var,
IConstant<?> val)
Return a new instance in which all occurrences of the given variable have
been replaced by the specified constant.
|
protected void |
checkArgs(BOp[] args)
Disallows
null in any position. |
Predicate<E> |
clearAnnotations(String[] names)
Strengthened return type.
|
Predicate<E> |
clone()
Overridden to provide a fast path clone().
|
IConstant<?> |
get(E e,
int index)
Return the asBound value at the specified index for the given element.
|
IVariableOrConstant |
get(int index)
Return an argument to the operation.
|
IAccessPathExpander<E> |
getAccessPathExpander()
Returns the object that may be used to selectively override the
evaluation of the predicate.
|
IFilter |
getAccessPathFilter()
Return the optional filter to be evaluated once tuples have been
converted into relation elements by the access path (local to the
caller).
|
IFilter |
getIndexLocalFilter()
Return the optional filter to be evaluated local to the index.
|
IKeyOrder<E> |
getKeyOrder()
Return the
IKeyOrder override for this IPredicate by the
query optimizer. |
String |
getOnlyRelationName()
Resource identifier (aka namespace) identifies the
IRelation
associated with this IPredicate. |
int |
getPartitionId()
The index partition identifier and
-1 if no partition
identifier was specified. |
int |
getRelationCount()
The #of elements in the relation view.
|
String |
getRelationName(int index)
Return the ith element of the relation view.
|
long |
getTimestamp()
The timestamp or transaction identifier on which the operator will read
or write.
|
int |
getVariableCount() |
int |
getVariableCount(IKeyOrder<E> keyOrder)
The #of arguments in the predicate required for the specified
IKeyOrder which are unbound. |
boolean |
isFullyBound(IKeyOrder<E> keyOrder)
Figure out if all positions in the predicate which are required to form
the key for this access path are bound in the predicate.
|
boolean |
isOptional()
true iff the predicate is optional when evaluated as the
right-hand side of a join. |
boolean |
isRemoteAccessPath()
Return
true if this is a remote access path. |
RangeBOp |
range() |
Predicate<E> |
setArg(int index,
IVariableOrConstant arg)
Return a copy of this predicate with a different
IVariableOrConstant
for the arg specified by the supplied index parameter. |
Predicate<E> |
setBOpId(int bopId)
Sets the
BOp.Annotations.BOP_ID annotation. |
Predicate<E> |
setPartitionId(int partitionId)
Sets the index partition identifier constraint.
|
Predicate<E> |
setRelationName(String[] relationName)
A copy of this
IPredicate in which the relationName(s)
replace the existing set of relation name(s). |
Predicate<E> |
setTimestamp(long timestamp) |
String |
toString()
Return a non-recursive representation of the arguments and annotations
for this
BOp. |
String |
toString(IBindingSet bindingSet)
Representation of the predicate with variable bindings.
|
__replaceArg, _clearProperty, _set, _setProperty, annotations, annotationsCopy, annotationsEqual, annotationsRef, argIterator, args, argsCopy, arity, clearProperty, deepCopy, deepCopy, getProperty, setArg, setProperty, setUnboundProperty, toArray, toArrayannotationsEqual, annotationsToString, annotationsToString, annotationValueToString, equals, getEvaluationContext, getId, getProperty, getRequiredProperty, hashCode, indent, isController, mutation, shortenName, toShortString, toStringfinalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCodeannotations, argIterator, args, arity, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortString, toStringgetPropertypublic Predicate(BOp[] args, Map<String,Object> annotations)
public Predicate(Predicate<E> op)
com.bigdata.bop.BOpUtility#deepCopy(FilterNode).public Predicate(BOp[] args, NV... annotations)
vars - annotations - public Predicate(IVariableOrConstant<?>[] values, String relationName, long timestamp)
values - The values (order is important!).relationName - Identifies the relation to be queried.public Predicate(IVariableOrConstant<?>[] values, String relationName, int partitionId, boolean optional, IElementFilter<E> constraint, IAccessPathExpander<E> expander, long timestamp)
relationName - The namespace of the relation.partitionId - The index partition constraint -or- -1 if there
is no index partition constraint.values - The values (order is important!).optional - true iff the predicate is optional when evaluated in a JOIN.constraint - An optional constraint.expander - Allows selective override of the predicate evaluation.protected void checkArgs(BOp[] args)
null in any position.checkArgs in class CoreBaseBOpargs - public String getOnlyRelationName()
IPredicateIRelation
associated with this IPredicate.getOnlyRelationName in interface IPredicate<E>ILocatableResourceAnnotations.RELATION_NAMEpublic String getRelationName(int index)
IPredicategetRelationName in interface IPredicate<E>index - The index into the array of relation names in the view.public int getRelationCount()
IPredicategetRelationCount in interface IPredicate<E>public Predicate<E> setRelationName(String[] relationName)
IPredicateIPredicate in which the relationName(s)
replace the existing set of relation name(s).setRelationName in interface IPredicate<E>relationName - The relation name(s).public int getPartitionId()
IPredicate-1 if no partition
identifier was specified.getPartitionId in interface IPredicate<E>-1 if the
predicate is not locked to a specific index partition.IPredicate.Annotations.PARTITION_ID,
PartitionLocator,
AccessPath,
JoinMasterTaskpublic IVariableOrConstant get(int index)
BOpget in interface BOpget in interface IPredicate<E>get in class BOpBaseindex - The argument index in [0:BOp.arity()-1].public IConstant<?> get(E e, int index)
IPredicateNote: there is no general means available to implement this method of an awareness of the internal structure of the element type. General purpose record types, such as GOM or relation records, can generally implement this method in the context of the "schema" imposed by the predicate.
get in interface IPredicate<E>e - The element, which must implement IElement.index - The index.public final boolean isOptional()
IPredicatetrue iff the predicate is optional when evaluated as the
right-hand side of a join. An optional predicate will match once after
all matches in the data have been exhausted. By default, the match will
NOT bind any variables that have been determined to be bound by the
predicate based on the computed IEvaluationPlan.
For mutation, some IRelations may require that all variables
appearing in the head are bound. This and similar constraints can be
enforced using IConstraints on the IRule.
isOptional in interface IPredicate<E>true iff this predicate is optional when evaluating
a JOIN.public final IFilter getIndexLocalFilter()
IPredicategetIndexLocalFilter in interface IPredicate<E>IPredicate.Annotations.INDEX_LOCAL_FILTERpublic final IFilter getAccessPathFilter()
IPredicategetAccessPathFilter in interface IPredicate<E>IPredicate.Annotations.ACCESS_PATH_FILTERpublic final IAccessPathExpander<E> getAccessPathExpander()
IPredicategetAccessPathExpander in interface IPredicate<E>IAccessPathExpander.IPredicate.Annotations.ACCESS_PATH_EXPANDERpublic final int getVariableCount()
getVariableCount in interface IPredicate<E>public final boolean isFullyBound(IKeyOrder<E> keyOrder)
IPredicateisFullyBound in interface IPredicate<E>public final int getVariableCount(IKeyOrder<E> keyOrder)
IPredicateIKeyOrder which are unbound.getVariableCount in interface IPredicate<E>keyOrder - The key order.IKeyOrder.public final boolean isRemoteAccessPath()
IPredicatetrue if this is a remote access path.isRemoteAccessPath in interface IPredicate<E>IPredicate.Annotations.REMOTE_ACCESS_PATHpublic Predicate<E> asBound(IVariable<?> var, IConstant<?> val)
IPredicate
Note: The optimal IKeyOrder often changes when binding a variable
on a predicate.
asBound in interface IPredicate<E>var - The variable.val - The constant.public Predicate<E> asBound(IBindingSet bindingSet)
This reuses the annotations map since we know that the annotations will
not be changed by asBound(IBindingSet). That provides a
significant reduction in heap churn.
asBound in interface IPredicate<E>bindingSet - The binding set.IPredicate -or- null if the
IPredicate can not be unified with the
IBindingSet.(RDR query does too much work)protected final Predicate<E> _asBound(IBindingSet bindingSet)
public Object asBound(int index, IBindingSet bindingSet)
IPredicateasBound in interface IPredicate<E>index - The index into that predicate.bindingSet - The binding set.null if no binding is available
(the predicate is not bound at that index and the variable at
that index in the predicate is not bound in the binding set).public final RangeBOp range()
public IKeyOrder<E> getKeyOrder()
IPredicateIKeyOrder override for this IPredicate by the
query optimizer.getKeyOrder in interface IPredicate<E>IKeyOrder or null if the
IKeyOrder was not overridden.IPredicate.Annotations.KEY_ORDERpublic Predicate<E> clone()
Predicate
instance. However, subclasses MUST override this method. This change was
introduced on 11/17/2011 when a profiler showed a 13% of all time related
to a join intensive process in CoreBaseBOp.clone() using
reflection to make a copy of an asBound(IBindingSet) predicate.clone in interface BOpclone in class CoreBaseBOppublic Predicate<E> setPartitionId(int partitionId)
IPredicatesetPartitionId in interface IPredicate<E>partitionId - The index partition identifier.IPredicate.IPredicate.Annotations.PARTITION_IDpublic Predicate<E> setBOpId(int bopId)
IPredicateBOp.Annotations.BOP_ID annotation.setBOpId in interface IPredicate<E>bopId - The bop id.IPredicate.public Predicate<E> setArg(int index, IVariableOrConstant arg)
IPredicateIVariableOrConstant
for the arg specified by the supplied index parameter.setArg in interface IPredicate<E>public Predicate<E> addIndexLocalFilter(IFilter filter)
IPredicate.Annotations.INDEX_LOCAL_FILTER. When there is a filter for
the named property, the filters are combined. Otherwise the filter is
set.filter - The filter.public Predicate<E> addAccessPathFilter(IFilter filter)
IPredicate.Annotations.INDEX_LOCAL_FILTER. When there is a filter for
the named property, the filters are combined. Otherwise the filter is
set.filter - The filter.public Predicate<E> clearAnnotations(String[] names)
Strips off the named annotations.
clearAnnotations in class BOpBasenames - The annotations to be removed.BOp in which the specified annotations do
not appear.public String toString()
CoreBaseBOpBOp.toString in interface BOptoString in interface IPredicate<E>toString in class CoreBaseBOppublic String toString(IBindingSet bindingSet)
IPredicatetoString in interface IPredicate<E>bindingSet - The variable bindingspublic final long getTimestamp()
IPredicategetTimestamp in interface IPredicate<E>ITimestampAnnotations.TIMESTAMPCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.