E - The generic type of the elements in the buffer.F - The generic type of the elements in the relation associated with
the IPredicate.public abstract class MapBindingSetsOverShardsBuffer<E extends IBindingSet,F> extends AbstractUnsynchronizedArrayBuffer<E>
IBindingSet are mapped across the shards which will have
the data for the IPredicate.asBound(IBindingSet) IPredicate.
Unsynchronized (non-thread safe) buffer maps the IBindingSets across
the index partition(s) associated with an IPredicate and
IKeyOrder. For each source chunk, "as bound" versions of the target
IPredicate are constructed and the IBindingSets in the chunk
are reordered based on IKeyOrder.getFromKey(IKeyBuilder, IPredicate)
for each asBound predicate. The PartitionLocators are discovered for
each fromKey using an ordered locator scan and the binding sets are output
onto a shard or node specific IBuffer created by a concrete subclass.
The subclass is responsible for getting the binding sets from this node onto
the node associated with each output buffer.
| Modifier and Type | Field and Description |
|---|---|
protected AbstractScaleOutFederation<?> |
fed |
protected IPredicate<F> |
pred
The predicate from which we generate the asBound binding sets.
|
protected IRelation<F> |
relation
A scale-out view of the target relation.
|
protected long |
timestamp
The timestamp associated with the operation on the target access path.
|
| Constructor and Description |
|---|
MapBindingSetsOverShardsBuffer(IBigdataFederation<?> fed,
IPredicate<F> pred,
long timestamp,
int capacity) |
| Modifier and Type | Method and Description |
|---|---|
long |
flush()
Extended to flush each buffer which targets a specific index partition as
well.
|
protected IBuffer<IBindingSet[]> |
getBuffer(PartitionLocator locator)
Return the buffer used to absorb binding sets which target the specified
index partition.
|
protected IMetadataIndex |
getMetadataIndex(IKeyOrder<F> keyOrder)
Resolve a scale-out view of the metadata index for the target predicate.
|
Map<PartitionLocator,IBuffer<IBindingSet[]>> |
getSinks()
An immutable view of the sinks.
|
protected void |
handleChunk(E[] chunk)
Maps the chunk of
IBindingSets across the index partition(s) for
the sink join dimension. |
protected Iterator<PartitionLocator> |
locatorScan(IKeyOrder<F> keyOrder,
byte[] fromKey,
byte[] toKey)
Locator scan for the index partitions for that predicate as bound.
|
protected abstract IBuffer<IBindingSet[]> |
newBuffer(PartitionLocator locator)
Return a buffer onto which binding sets will be written which are
destined for the specified shard.
|
protected final AbstractScaleOutFederation<?> fed
protected final IPredicate<F> pred
IKeyOrder together determine the required
access path.protected final long timestamp
public MapBindingSetsOverShardsBuffer(IBigdataFederation<?> fed, IPredicate<F> pred, long timestamp, int capacity)
fed - The federation.pred - The predicate associated with the target operator. The
predicate identifies which variables and/or constants form the
key for the access path and hence selects the shards on which
the target operator must read or write. For example, when the
target operator is a JOIN, this is the IPredicate
associated with the right hand operator of the join.timestamp - The timestamp associated with the operation on the target
access path. If the binding sets will be used to read on the
shards of the target access path, then this is the read
timestamp. If they will be used to write on the target access
path, then this is the write timestamp.capacity - The capacity of this buffer.protected IMetadataIndex getMetadataIndex(IKeyOrder<F> keyOrder)
protected void handleChunk(E[] chunk)
IBindingSets across the index partition(s) for
the sink join dimension.handleChunk in class AbstractUnsynchronizedArrayBuffer<E extends IBindingSet>a - A chunk of IBindingSets.protected Iterator<PartitionLocator> locatorScan(IKeyOrder<F> keyOrder, byte[] fromKey, byte[] toKey)
public long flush()
Flush the buffer and return the #of elements written on the backing
IRelation since the counter was last IBuffer.reset() (the
mutationCount).
Note: If the buffer does not write on an IRelation then it SHOULD
return ZERO(0).
flush in interface IBuffer<E extends IBindingSet>flush in class AbstractUnsynchronizedArrayBuffer<E extends IBindingSet>IRelation.
See IMutableRelationpublic Map<PartitionLocator,IBuffer<IBindingSet[]>> getSinks()
protected IBuffer<IBindingSet[]> getBuffer(PartitionLocator locator)
locator - The locator for the target index partition.protected abstract IBuffer<IBindingSet[]> newBuffer(PartitionLocator locator)
Note: The concrete implementation may chose whether to associate buffers with the target shard or the target node.
locator - The locator for the target index partition.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.