本文整理汇总了Java中org.apache.accumulo.core.iterators.SortedKeyValueIterator.seek方法的典型用法代码示例。如果您正苦于以下问题:Java SortedKeyValueIterator.seek方法的具体用法?Java SortedKeyValueIterator.seek怎么用?Java SortedKeyValueIterator.seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.iterators.SortedKeyValueIterator
的用法示例。
在下文中一共展示了SortedKeyValueIterator.seek方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runTest
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的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);
}
示例2: TestData
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的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);
}
}
示例3: runQuery
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
private Map<Set<Tag>, Aggregation> runQuery(SortedKeyValueIterator<Key, Value> iter,
SortedMap<Key, Value> testData, long period) throws Exception {
IteratorSetting is = new IteratorSetting(100, AggregationIterator.class);
AggregationIterator.setAggregationOptions(is, Collections.singletonMap("host", ".*"), Avg.class.getName());
SortedKeyValueIterator<Key, Value> source = new SortedMapIterator(testData);
iter.init(source, is.getOptions(), null);
iter.seek(new Range(), Collections.emptyList(), true);
assertTrue(iter.hasTop());
Key key = iter.getTopKey();
assertEquals(testData.lastKey(), key);
Map<Set<Tag>, Aggregation> samples = AggregationIterator.decodeValue(iter.getTopValue());
return samples;
}
示例4: runQuery
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
private Map<Set<Tag>, Downsample> runQuery(SortedKeyValueIterator<Key, Value> iter, SortedMap<Key, Value> testData,
long period) throws Exception {
IteratorSetting is = new IteratorSetting(100, DownsampleIterator.class);
DownsampleIterator.setDownsampleOptions(is, 0, 1000, period, Avg.class.getName());
SortedKeyValueIterator<Key, Value> source = new SortedMapIterator(testData);
iter.init(source, is.getOptions(), null);
iter.seek(new Range(), Collections.emptyList(), true);
assertTrue(iter.hasTop());
Key key = iter.getTopKey();
assertEquals(testData.lastKey(), key);
Map<Set<Tag>, Downsample> samples = DownsampleIterator.decodeValue(iter.getTopValue());
return samples;
}
示例5: seek
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
// always start fresh
this.setTopKey(null);
this.setDone(false);
// get my user object which should be an iterator
SortedKeyValueIterator<?,?> iter = (SortedKeyValueIterator<?,?>) this.getUserObject();
if (iter != null) {
iter.seek(range, columnFamilies, inclusive);
if (iter.hasTop()) {
Key key = (Key) iter.getTopKey();
key = buildKey(key);
this.setTopKey(key);
if (log.isDebugEnabled()) {
log.debug("BLTNODE.seek() -> found: " + this.getTopKey());
}
} else {
if (log.isDebugEnabled()) {
log.debug("BLTNODE.seek() -> hasTop::false");
}
this.setDone(true);
}
} else {
if (log.isDebugEnabled()) {
log.debug("BLTNODE.seek(), The iterator was null!");
}
this.setTopKey(null);
}
}
示例6: seek
import org.apache.accumulo.core.iterators.SortedKeyValueIterator; //导入方法依赖的package包/类
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
// always start fresh
this.setTopKey(null);
this.setDone(false);
// get my user object which should be an iterator
SortedKeyValueIterator<?, ?> iter = (SortedKeyValueIterator<?, ?>) this.getUserObject();
if (iter != null) {
iter.seek(range, columnFamilies, inclusive);
if (iter.hasTop()) {
Key key = (Key) iter.getTopKey();
key = buildKey(key);
this.setTopKey(key);
if (log.isDebugEnabled()) {
log.debug("BLTNODE.seek() -> found: " + this.getTopKey());
}
} else {
if (log.isDebugEnabled()) {
log.debug("BLTNODE.seek() -> hasTop::false");
}
this.setDone(true);
}
} else {
if (log.isDebugEnabled()) {
log.debug("BLTNODE.seek(), The iterator was null!");
}
this.setTopKey(null);
}
}