本文整理汇总了Java中org.apache.accumulo.core.data.ByteSequence类的典型用法代码示例。如果您正苦于以下问题:Java ByteSequence类的具体用法?Java ByteSequence怎么用?Java ByteSequence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ByteSequence类属于org.apache.accumulo.core.data包,在下文中一共展示了ByteSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
@Override
public void seek(Range range, Collection<ByteSequence> seekColumnFamilies, boolean inclusive) throws IOException {
sampleII.seek(range, seekColumnFamilies, inclusive);
// this check will be redone whenever iterator stack is torn down and recreated.
int count = 0;
while (count <= sampleMax && sampleII.hasTop()) {
sampleII.next();
count++;
}
if (count > sampleMax) {
// In a real application would probably want to return a key value that indicates too much data. Since this would execute for each tablet, some tablets
// may return data. For tablets that did not return data, would want an indication.
hasTop = false;
} else {
hasTop = true;
super.seek(range, seekColumnFamilies, inclusive);
}
}
示例2: runTest
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
private void runTest(boolean reseek, TreeMap<Key,Value> source, TreeMap<Key,Value> result, Collection<ByteSequence> cols) throws IOException {
MapIterator src = new MapIterator(source);
SortedKeyValueIterator<Key,Value> iter = new ChunkCombiner();
iter.init(src, null, null);
iter = iter.deepCopy(null);
iter.seek(new Range(), cols, true);
TreeMap<Key,Value> seen = new TreeMap<>();
while (iter.hasTop()) {
assertFalse("already contains " + iter.getTopKey(), seen.containsKey(iter.getTopKey()));
seen.put(new Key(iter.getTopKey()), new Value(iter.getTopValue()));
if (reseek)
iter.seek(new Range(iter.getTopKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL), true, null, true), cols, true);
else
iter.next();
}
assertEquals(result, seen);
}
示例3: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
/**
* Seek to the next matching cell and call next to populate the key and value.
*/
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
if (t.isAlive()) {
// Check for error
if (thread.hasError())
throw new IOException("background thread has error", thread.getError());
try {
// Acquire the lock, or wait until its unlocked by the producer thread.
thread.lock();
queue.clear();
currentElement = null;
source.seek(range, columnFamilies, inclusive);
} finally {
thread.unlock();
}
next();
} else {
throw new IOException("source iterator thread has died.");
}
}
示例4: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
// do not want to seek to the middle of a value that should be
// aggregated...
seekRange = maximizeStartKeyTimeStamp(range);
iterator.seek(seekRange, columnFamilies, inclusive);
findTop();
if (range.getStartKey() != null) {
while (hasTop() && getTopKey().equals(range.getStartKey(), this.comparator) && getTopKey().getTimestamp() > range.getStartKey().getTimestamp()) {
// the value has a more recent time stamp, so
// pass it up
// log.debug("skipping "+getTopKey());
next();
}
while (hasTop() && range.beforeStartKey(getTopKey())) {
next();
}
}
}
示例5: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
@Override
public void seek(final Range range, final Collection<ByteSequence> seekColumnFamilies, final boolean inclusive) throws IOException {
overallRange = new Range(range);
currentPartition = new Text();
currentDocID.set(emptyByteArray);
// seek each of the sources to the right column family within the row given by key
for (int i = 0; i < sourcesCount; i++) {
Key sourceKey;
if (range.getStartKey() != null) {
if (range.getStartKey().getColumnQualifier() != null) {
sourceKey = buildKey(getPartition(range.getStartKey()), sources[i].term, range.getStartKey().getColumnQualifier());
} else {
sourceKey = buildKey(getPartition(range.getStartKey()), sources[i].term);
}
// Seek only to the term for this source as a column family
sources[i].iter.seek(new Range(sourceKey, true, null, false), sources[i].seekColfams, true);
} else {
// Seek only to the term for this source as a column family
sources[i].iter.seek(range, sources[i].seekColfams, true);
}
}
advanceToIntersection();
}
示例6: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
@Override
public void seek(final Range range, final Collection<ByteSequence> columnFamilies, final boolean inclusive)
throws IOException {
// do not want to seek to the middle of a value that should be
// combined...
final Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range);
super.seek(seekRange, columnFamilies, inclusive);
findTop();
if (null != range.getStartKey()) {
while (hasTop() && getTopKey().equals(range.getStartKey(), PartialKey.ROW_COLFAM)
&& getTopKey().getTimestamp() > range.getStartKey().getTimestamp()) {
// The value has a more recent time stamp, so pass it up
next();
}
while (hasTop() && range.beforeStartKey(getTopKey())) {
next();
}
}
}
示例7: readNextRow
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
private SortedMap<Key, Value> readNextRow(){
ByteSequence prevRowId = null;
TreeMap<Key, Value> row = new TreeMap<Key, Value>();
while(this.prevEntry != null || this.results != null && this.results.hasNext()) {
Entry<Key, Value> entry = null;
if (this.prevEntry != null) {
entry = this.prevEntry;
this.prevEntry = null;
}
else {
entry = this.results.next();
}
ByteSequence rowId = entry.getKey().getRowData();
if (prevRowId == null || prevRowId.equals(rowId)) {
prevRowId= rowId;
row.put(entry.getKey(), entry.getValue());
}
else {
this.prevEntry = entry;
return row;
}
}
return row;
}
示例8: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies,
boolean inclusive) throws IOException {
super.seek(range, columnFamilies, inclusive);
if (getSource().hasTop()) {
int count = 0;
ByteSequence prevRowId = null;
while (getSource().hasTop()) {
Key key = getSource().getTopKey();
ByteSequence rowId = key.getRowData();
if (prevRowId == null || !prevRowId.equals(rowId)) {
count++;
prevRowId = rowId;
}
getSource().next();
}
this.topKey = new Key("1", this.alias, this.alias);//$NON-NLS-1$
this.topValue = new Value(AccumuloDataTypeManager.convertToAccumuloType(Long.valueOf(count), this.encoding));
}
}
示例9: getProgressForRange
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
private static float getProgressForRange(
final ByteSequence start,
final ByteSequence end,
final ByteSequence position ) {
final int maxDepth = Math.min(
Math.max(
end.length(),
start.length()),
position.length());
final BigInteger startBI = new BigInteger(
SplitsProvider.extractBytes(
start.getBackingArray(),
maxDepth));
final BigInteger endBI = new BigInteger(
SplitsProvider.extractBytes(
end.getBackingArray(),
maxDepth));
final BigInteger positionBI = new BigInteger(
SplitsProvider.extractBytes(
position.getBackingArray(),
maxDepth));
return (float) (positionBI.subtract(
startBI).doubleValue() / endBI.subtract(
startBI).doubleValue());
}
示例10: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
lastDelete = new Key();
Collection<ByteSequence> fams;
if (columnFamilies.isEmpty() && !inclusive) {
fams = SnapshotIterator.NOTIFY_CF_SET;
inclusive = false;
} else {
fams = columnFamilies;
}
source.seek(range, fams, inclusive);
findTop();
}
示例11: TestData
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
TestData(SortedKeyValueIterator<Key, Value> iter, Range range, boolean reseek) {
try {
iter.seek(range, new HashSet<ByteSequence>(), false);
while (iter.hasTop()) {
data.put(iter.getTopKey(), iter.getTopValue());
if (reseek) {
iter.seek(
new Range(iter.getTopKey(), false, range.getEndKey(), range.isEndKeyInclusive()),
new HashSet<ByteSequence>(), false);
} else {
iter.next();
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例12: rollback
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
private static void rollback(Environment env, long startTs, PrimaryRowColumn prc,
List<LockInfo> value, Map<ByteSequence, Mutation> mutations) {
for (LockInfo lockInfo : value) {
if (isPrimary(prc, lockInfo.entry.getKey())) {
continue;
}
Mutation mut = getMutation(lockInfo.entry.getKey().getRowData(), mutations);
Key k = lockInfo.entry.getKey();
if (lockInfo.isReadLock) {
mut.put(k.getColumnFamilyData().toArray(), k.getColumnQualifierData().toArray(),
k.getColumnVisibilityParsed(),
ColumnConstants.RLOCK_PREFIX | ReadLockUtil.encodeTs(lockInfo.lockTs, true),
DelReadLockValue.encodeRollback());
} else {
mut.put(k.getColumnFamilyData().toArray(), k.getColumnQualifierData().toArray(),
k.getColumnVisibilityParsed(), ColumnConstants.DEL_LOCK_PREFIX | lockInfo.lockTs,
DelLockValue.encodeRollback(false, true));
}
}
}
示例13: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
/**
* Seek to the next matching cell and call next to populate the key and value.
*/
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
if (t.isAlive()) {
// Check for error
if (thread.hasError())
throw new IOException("background thread has error", thread.getError());
try {
// Acquire the lock, or wait until its unlocked by the producer thread.
thread.lock();
queue.clear();
currentElement = null;
source.seek(range, columnFamilies, inclusive);
} finally {
thread.unlock();
}
next();
} else {
throw new IOException("source iterator thread has died.");
}
}
示例14: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
// do not want to seek to the middle of a value that should be
// aggregated...
seekRange = maximizeStartKeyTimeStamp(range);
iterator.seek(seekRange, columnFamilies, inclusive);
findTop();
if (range.getStartKey() != null) {
while (hasTop() && getTopKey().equals(range.getStartKey(), this.comparator) && getTopKey().getTimestamp() > range.getStartKey().getTimestamp()) {
// the value has a more recent time stamp, so
// pass it up
// log.debug("skipping "+getTopKey());
next();
}
while (hasTop() && range.beforeStartKey(getTopKey())) {
next();
}
}
}
示例15: seek
import org.apache.accumulo.core.data.ByteSequence; //导入依赖的package包/类
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
topKey = null;
topValue = null;
Key sk = range.getStartKey();
if (sk != null && sk.getColumnFamilyData().length() == 0 && sk.getColumnQualifierData().length() == 0 && sk.getColumnVisibilityData().length() == 0
&& sk.getTimestamp() == Long.MAX_VALUE && !range.isStartKeyInclusive()) {
// assuming that we are seeking using a key previously returned by this iterator
// therefore go to the next row
Key followingRowKey = sk.followingKey(PartialKey.ROW);
if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0)
return;
range = new Range(sk.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive());
}
sourceIter.seek(range, columnFamilies, inclusive);
prepKeys();
}