当前位置: 首页>>代码示例>>Java>>正文


Java SortedKeyValueIterator.seek方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:22,代码来源:ChunkCombinerTest.java

示例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);
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:19,代码来源:TestData.java

示例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;
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:14,代码来源:AggregationIteratorTest.java

示例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;
}
 
开发者ID:NationalSecurityAgency,项目名称:timely,代码行数:14,代码来源:DownsampleIteratorTest.java

示例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);
  }
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:34,代码来源:BooleanLogicTreeNode.java

示例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);
        }
    }
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:34,代码来源:BooleanLogicTreeNode.java


注:本文中的org.apache.accumulo.core.iterators.SortedKeyValueIterator.seek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。