public abstract class AbstractSplitter extends Object implements ISplitter
IMetadataIndex
.Modifier and Type | Field and Description |
---|---|
protected static org.apache.log4j.Logger |
log |
Constructor and Description |
---|
AbstractSplitter() |
Modifier and Type | Method and Description |
---|---|
protected abstract IMetadataIndex |
getMetadataIndex(long ts)
Return the
IMetadataIndex that will be used to compute the
Split s |
LinkedList<Split> |
splitKeys(long ts,
int fromIndex,
int toIndex,
byte[][] keys)
|
LinkedList<Split> |
splitKeys(long ts,
int fromIndex,
int toIndex,
KVO[] a)
Reshape the data into an unsigned byte[][] and then invoke
splitKeys(long, int, int, byte[][]) . |
protected abstract IMetadataIndex getMetadataIndex(long ts)
IMetadataIndex
that will be used to compute the
Split
sts
- The timestamp of the IMetadataIndex
view.IMetadataIndex
.public LinkedList<Split> splitKeys(long ts, int fromIndex, int toIndex, byte[][] keys)
Split
s for an ordered array of keys such that there
is one Split
per index partition spanned by the data.
Find the partition for the first key. Check the last key, if it is in the
same partition then then this is the simplest case and we can just send
the data along.
Otherwise, perform a binary search on the remaining keys looking for the index of the first key GTE the right separator key for that partition. The batch for this partition is formed from all keys from the first key for that partition up to but excluding the index position identified by the binary search (if there is a match; if there is a miss, then the binary search result needs to be converted into a key index and that will be the last key for the current partition).
Examine the next key and repeat the process until all keys have been allocated to index partitions.
Note: Split points MUST respect the "row" identity for a sparse row store, but we get that constraint by maintaining the index partition boundaries in agreement with the split point constraints for the index.
Note: The splitter always detect keys out of order and will throw an
IllegalArgumentException
. This is done since it is otherwise too
easy for applications to produce unordered data which would then quietly
violate this expectation if we relied on asserts.
splitKeys
in interface ISplitter
ts
- The timestamp for the IMetadataIndex
view that will be
applied to choose the Split
s.fromIndex
- The index of the first key in keys to be processed
(inclusive).toIndex
- The index of the last key in keys to be processed.keys
- An array of keys. Each key is an interpreted as an unsigned
byte[] which fully specifies the desired tuple (no prefix
scans). All keys must be non-null. The keys must be in sorted
order.Split
s. Each Split.pmd
pairs the keys
in the (fromIndex,toIndex] range with a PartitionLocator
.Arrays.sort(Object[], int, int, java.util.Comparator)
,
BytesUtil.compareBytes(byte[], byte[])
public LinkedList<Split> splitKeys(long ts, int fromIndex, int toIndex, KVO[] a)
splitKeys(long, int, int, byte[][])
.splitKeys
in interface ISplitter
ts
- The timestamp for the IMetadataIndex
view that will be
applied to choose the Split
s.fromIndex
- The index of the first key in keys to be processed
(inclusive).toIndex
- The index of the last key in keys to be processed.Split
s that you can use to form requests based on the
identified first/last key and partition identified by this
process.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.