E
- The generic type of the objects processed by the operator.public class BOpContext<E> extends BOpContextBase
Constructor and Description |
---|
BOpContext(IRunningQuery runningQuery,
int partitionId,
BOpStats stats,
PipelineOp op,
boolean lastInvocation,
ICloseableIterator<E[]> source,
IBlockingBuffer<E[]> sink,
IBlockingBuffer<E[]> sink2) |
Modifier and Type | Method and Description |
---|---|
static IBindingSet |
bind(IBindingSet left,
IBindingSet right,
IConstraint[] constraints,
IVariable[] varsToKeep)
Copy the values for variables from the source
IBindingSet to the
destination IBindingSet . |
static boolean |
bind(IPredicate<?> pred,
IConstraint[] constraints,
Object e,
IBindingSet bindings)
Deprecated.
|
static void |
copyValues(IElement e,
IPredicate<?> pred,
IBindingSet bindingSet)
Copy the values for variables in the predicate from the element, applying
them to the caller's
IBindingSet . |
ICloseableIterator<IBindingSet[]> |
getAlternateSource(INamedSolutionSetRef namedSetRef)
Return an
ICloseableIterator that can be used to read the
solutions to be indexed from a source other than the pipeline. |
org.eclipse.jetty.client.HttpClient |
getClientConnectionManager()
Return the
HttpClient used to make remote SERVICE
call requests. |
IMemoryManager |
getMemoryManager(UUID queryId)
Return the
IMemoryManager associated with the specified query. |
PipelineOp |
getOperator()
Return the operator that is being executed.
|
int |
getPartitionId()
The index partition identifier -or-
-1 if the index is not
sharded. |
IQueryAttributes |
getQueryAttributes()
Return the
IQueryAttributes associated with this query. |
IQueryAttributes |
getQueryAttributes(UUID queryId)
Return the
IQueryAttributes associated with the specified query. |
IRunningQuery |
getRunningQuery()
The interface for a running query.
|
IRunningQuery |
getRunningQuery(UUID queryId)
Return the
IRunningQuery associated with the specified queryId. |
IBlockingBuffer<E[]> |
getSink()
Where to write the output of the operator.
|
IBlockingBuffer<E[]> |
getSink2()
Optional alternative sink for the output of the operator.
|
ICloseableIterator<E[]> |
getSource()
Where to read the data to be consumed by the operator.
|
BOpStats |
getStats()
The object used to collect statistics about the evaluation of this
operator.
|
boolean |
isLastInvocation()
true iff this is the last invocation of the operator. |
static <E> BOpContext<E> |
newMock(IRunningQuery runningQuery,
IBigdataFederation<?> fed,
IIndexManager localIndexManager,
int partitionId,
BOpStats stats,
PipelineOp op,
boolean lastInvocation,
ICloseableIterator<E[]> source,
IBlockingBuffer<E[]> sink,
IBlockingBuffer<E[]> sink2)
Test suite helper.
|
ICloseableIterator<IBindingSet[]> |
solutions(IChunkedIterator<?> src,
IPredicate<?> pred,
BaseJoinStats stats)
Convert an
IAccessPath.iterator() into a stream of chunks of
IBindingSet . |
getAccessPath, getExecutorService, getFederation, getIndexManager, getRelation, getResource
public BOpContext(IRunningQuery runningQuery, int partitionId, BOpStats stats, PipelineOp op, boolean lastInvocation, ICloseableIterator<E[]> source, IBlockingBuffer<E[]> sink, IBlockingBuffer<E[]> sink2)
runningQuery
- The IRunningQuery
(required).partitionId
- The index partition identifier -or- -1
if the
index is not sharded.stats
- The object used to collect statistics about the evaluation of
this operator.source
- Where to read the data to be consumed by the operator.op
- The operator that is being executed.lastInvocation
- true
iff this is the last invocation pass for
that operator.sink
- Where to write the output of the operator.sink2
- Alternative sink for the output of the operator (optional).
This is used by things like SPARQL optional joins to route
failed joins outside of the join group.IllegalArgumentException
- if the stats is null
IllegalArgumentException
- if the source is null
(use an empty
source if the source will be ignored).IllegalArgumentException
- if the sink is null
public boolean isLastInvocation()
true
iff this is the last invocation of the operator. The
property is only set to true
for operators which:
PipelineOp.Annotations.LAST_PASS
is true
PipelineOp.Annotations.PIPELINED
is true
PipelineOp.Annotations.MAX_PARALLEL
is 1
IQueryClient
to
atomically decide that a specific invocation of the operator task for the
query will be the last invocation for that task. This is not possible if
the operator allows concurrent evaluation tasks. Sharded operators are
intrinsically concurrent since they can evaluate at each shard in
parallel. This is why the evaluation context is locked to the query
controller. In addition, the operator must declare that it is NOT thread
safe in order for the query engine to serialize its evaluation tasks.public IRunningQuery getRunningQuery()
Note: In scale-out each node will have a distinct IRunningQuery
object and the query controller will have access to additional state,
such as the aggregation of the BOpStats
for the query on all
nodes.
public final int getPartitionId()
-1
if the index is not
sharded.public final BOpStats getStats()
public PipelineOp getOperator()
public final ICloseableIterator<E[]> getSource()
public final IBlockingBuffer<E[]> getSink()
PipelineOp.Annotations.SINK_REF
public final IBlockingBuffer<E[]> getSink2()
PipelineOp.Annotations.ALT_SINK_REF
,
PipelineOp.Annotations#ALT_SINK_GROUP
public static <E> BOpContext<E> newMock(IRunningQuery runningQuery, IBigdataFederation<?> fed, IIndexManager localIndexManager, int partitionId, BOpStats stats, PipelineOp op, boolean lastInvocation, ICloseableIterator<E[]> source, IBlockingBuffer<E[]> sink, IBlockingBuffer<E[]> sink2)
public IRunningQuery getRunningQuery(UUID queryId)
IRunningQuery
associated with the specified queryId.queryId
- The UUID
of some IRunningQuery
.IRunningQuery
.RuntimeException
- if the IRunningQuery
has halted.RuntimeException
- if the IRunningQuery
is not found.public IQueryAttributes getQueryAttributes(UUID queryId)
IQueryAttributes
associated with the specified query.queryId
- The UUID
of some IRunningQuery
-or- null to
use the IQueryAttributes
of this query.IQueryAttributes
for that IRunningQuery
.RuntimeException
- if the IRunningQuery
has halted.RuntimeException
- if the IRunningQuery
is not found.public IQueryAttributes getQueryAttributes()
IQueryAttributes
associated with this query.IQueryAttributes
.public ICloseableIterator<IBindingSet[]> getAlternateSource(INamedSolutionSetRef namedSetRef)
ICloseableIterator
that can be used to read the
solutions to be indexed from a source other than the pipeline. The
returned iterator is intentionally aligned with the type returned by
getSource()
.null
.RuntimeException
- if the source can not be resolved.public IMemoryManager getMemoryManager(UUID queryId)
IMemoryManager
associated with the specified query.queryId
- The UUID
of some IRunningQuery
-or- null to
use the IMemoryManager
of this query.IMemoryManager
for that IRunningQuery
.RuntimeException
- if the IRunningQuery
has halted.RuntimeException
- if the IRunningQuery
is not found.public org.eclipse.jetty.client.HttpClient getClientConnectionManager()
HttpClient
used to make remote SERVICE
call requests.@Deprecated public static final boolean bind(IPredicate<?> pred, IConstraint[] constraints, Object e, IBindingSet bindings)
Note: The bindings are propagated before the constraints are verified so this method will have a side-effect on the bindings even if the constraints were not satisfied. Therefore you should clone the bindings before calling this method.
pred
- The IPredicate
from which the element was read.constraint
- A constraint which must be satisfied (optional).e
- An element materialized by the IAccessPath
for that
IPredicate
.bindingSet
- the bindings to which new bindings from the element will be
applied.true
unless the new bindings would violate any of
the optional IConstraint
.NullPointerException
- if an argument is null
.public static void copyValues(IElement e, IPredicate<?> pred, IBindingSet bindingSet)
IBindingSet
.
Note: A variable which is bound outside of the query to a constant gets
turned into a Constant
with that variable as its annotation. This
method causes the binding to be created for the variable and the constant
when the constant is JOINed.
e
- The element.pred
- The predicate.bindingSet
- The binding set, which is modified as a side-effect.
TODO Make this method package private once we convert to using
an inline access path.public static IBindingSet bind(IBindingSet left, IBindingSet right, IConstraint[] constraints, IVariable[] varsToKeep)
IBindingSet
to the
destination IBindingSet
. It is an error if a binding already
exists in the destination IBindingSet
which is not consistent
with a binding in the source IBindingSet
.left
- The left binding set (target).right
- The right binding set (source).constraints
- An array of constraints (optional). When given, destination
IBindingSet
will be validated after mutation.varsToKeep
- An array of variables whose bindings will be retained. The
bindings are not stripped out until after the constraint(s)
(if any) have been tested.null
if
the bindings were not consistent, if a constraint was violated,
etc. Note that either left
or right
MAY
be returned if the other solution set is empty (optimization).public ICloseableIterator<IBindingSet[]> solutions(IChunkedIterator<?> src, IPredicate<?> pred, BaseJoinStats stats)
IAccessPath.iterator()
into a stream of chunks of
IBindingSet
.src
- The iterator draining the IAccessPath
. This will visit
IElement
s.pred
- The predicate for that IAccessPath
stats
- Statistics to be updated as elements and chunks are consumed
(optional).IElement
s is preserved.(AccessPath
should visit binding sets rather than elements when used for high
level query.)
,
(Inline access
path).
TODO Move to {@link IAccessPath}? {@link AccessPath}?
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.