org.apache.accumulo.core.data.Range.afterEndKey()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.apache.accumulo.core.data.Range.afterEndKey方法的一些代码示例,展示了Range.afterEndKey的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Range.afterEndKey方法的具体详情如下:
包路径:org.apache.accumulo.core.data.Range
类名称:Range
方法名:afterEndKey

Range.afterEndKey介绍

[英]Determines if the given key is after the ending key of this range.
[中]确定给定的键是否在该范围的结束键之后。

代码示例

代码示例来源:origin: prestodb/presto

/**
   * Gets a Boolean value indicating if the given value is in one of the Ranges in the given collection
   *
   * @param text Text object to check against the Range collection
   * @param ranges Ranges to look into
   * @return True if the text object is in one of the ranges, false otherwise
   */
  private static boolean inRange(Text text, Collection<Range> ranges)
  {
    Key kCq = new Key(text);
    return ranges.stream().anyMatch(r -> !r.beforeStartKey(kCq) && !r.afterEndKey(kCq));
  }
}

代码示例来源:origin: apache/accumulo

/**
 * Determines if the given key falls within this range.
 *
 * @param key
 *          key to consider
 * @return true if the given key falls within the range, false otherwise
 */
public boolean contains(Key key) {
 return !beforeStartKey(key) && !afterEndKey(key);
}

代码示例来源:origin: apache/accumulo

@Override
public void next() throws IOException {
 if (entry == null)
  throw new IllegalStateException();
 if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get())
  throw new IterationInterruptedException();
 if (iter.hasNext()) {
  entry = iter.next();
  if (range.afterEndKey(entry.getKey())) {
   entry = null;
  }
 } else
  entry = null;
}

代码示例来源:origin: apache/accumulo

@Override
public boolean hasTop() {
 return source.hasTop() && !range.afterEndKey(getTopKey());
}

代码示例来源:origin: apache/accumulo

@Override
public void next() {
 if (entry == null)
  throw new IllegalStateException();
 // checking the interrupt flag for every call to next had bad a bad performance impact
 // so check it every 100th time
 if (interruptFlag != null && interruptCheckCount++ % 100 == 0 && interruptFlag.get())
  throw new IterationInterruptedException();
 if (iter.hasNext()) {
  entry = iter.next();
  if (range.afterEndKey(entry.getKey())) {
   entry = null;
  }
 } else
  entry = null;
}

代码示例来源:origin: apache/accumulo

@Override
public void next() throws IOException {
 if (!hasTop)
  throw new IllegalStateException();
 reader.next();
 hasTop = reader.hasTop() && !range.afterEndKey(reader.getTopKey());
}

代码示例来源:origin: apache/accumulo

@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
  throws IOException {
 if (interruptFlag != null && interruptFlag.get())
  throw new IterationInterruptedException();
 this.range = range;
 Key key = range.getStartKey();
 if (key == null) {
  key = new Key();
 }
 iter = map.tailMap(key).entrySet().iterator();
 if (iter.hasNext()) {
  entry = iter.next();
  if (range.afterEndKey(entry.getKey())) {
   entry = null;
  }
 } else
  entry = null;
 while (hasTop() && range.beforeStartKey(getTopKey())) {
  next();
 }
}

代码示例来源:origin: apache/accumulo

static void trackScanning(Map<KeyExtent,List<Range>> failures,
  Map<KeyExtent,List<Range>> unscanned, MultiScanResult scanResult) {
 // translate returned failures, remove them from unscanned, and add them to failures
 Map<KeyExtent,List<Range>> retFailures = Translator.translate(scanResult.failures,
   Translators.TKET, new Translator.ListTranslator<>(Translators.TRT));
 unscanned.keySet().removeAll(retFailures.keySet());
 failures.putAll(retFailures);
 // translate full scans and remove them from unscanned
 HashSet<KeyExtent> fullScans = new HashSet<>(
   Translator.translate(scanResult.fullScans, Translators.TKET));
 unscanned.keySet().removeAll(fullScans);
 // remove partial scan from unscanned
 if (scanResult.partScan != null) {
  KeyExtent ke = new KeyExtent(scanResult.partScan);
  Key nextKey = new Key(scanResult.partNextKey);
  ListIterator<Range> iterator = unscanned.get(ke).listIterator();
  while (iterator.hasNext()) {
   Range range = iterator.next();
   if (range.afterEndKey(nextKey) || (nextKey.equals(range.getEndKey())
     && scanResult.partNextKeyInclusive != range.isEndKeyInclusive())) {
    iterator.remove();
   } else if (range.contains(nextKey)) {
    iterator.remove();
    Range partRange = new Range(nextKey, scanResult.partNextKeyInclusive, range.getEndKey(),
      range.isEndKeyInclusive());
    iterator.add(partRange);
   }
  }
 }
}

代码示例来源:origin: apache/accumulo

.afterEndKey(new Key(tl.tablet_extent.getEndRow()).followingKey(PartialKey.ROW))) {
if (useCache) {
 Text row = new Text(tl.tablet_extent.getEndRow());

代码示例来源:origin: apache/accumulo

@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
  throws IOException {
 reader.seek(range, columnFamilies, inclusive);
 this.range = range;
 hasTop = reader.hasTop() && !range.afterEndKey(reader.getTopKey());
 while (hasTop() && range.beforeStartKey(getTopKey())) {
  next();
 }
}

代码示例来源:origin: apache/accumulo

private void _next() throws IOException {
 if (!hasTop)
  throw new IllegalStateException();
 if (entriesLeft == 0) {
  currBlock.close();
  if (metricsGatherer != null)
   metricsGatherer.startBlock();
  if (iiter.hasNext()) {
   IndexEntry indexEntry = iiter.next();
   entriesLeft = indexEntry.getNumEntries();
   currBlock = getDataBlock(indexEntry);
   checkRange = range.afterEndKey(indexEntry.getKey());
   if (!checkRange)
    hasTop = true;
  } else {
   rk = null;
   val = null;
   hasTop = false;
   return;
  }
 }
 prevKey = rk.getKey();
 rk.readFields(currBlock);
 val.readFields(currBlock);
 if (metricsGatherer != null)
  metricsGatherer.addMetric(rk.getKey(), val);
 entriesLeft--;
 if (checkRange)
  hasTop = !range.afterEndKey(rk.getKey());
}

代码示例来源:origin: apache/accumulo

@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) {
 if (interruptFlag != null && interruptFlag.get())
  throw new IterationInterruptedException();
 iter.delete();
 this.range = range;
 Key key = range.getStartKey();
 if (key == null) {
  key = new MemKey();
 }
 iter = map.new ConcurrentIterator(key);
 if (iter.hasNext()) {
  entry = iter.next();
  if (range.afterEndKey(entry.getKey())) {
   entry = null;
  }
 } else
  entry = null;
 while (hasTop() && range.beforeStartKey(getTopKey())) {
  next();
 }
}

代码示例来源:origin: apache/accumulo

lastRowText.set(lastRow.getBackingArray(), lastRow.offset(), lastRow.length());
Key startKey = new Key(lastRowText).followingKey(PartialKey.ROW);
if (!range.afterEndKey(startKey)) {
 seekRange = new Range(startKey, true, range.getEndKey(), range.isEndKeyInclusive());

代码示例来源:origin: apache/accumulo

private void reseek(Key key) throws IOException {
 if (range.afterEndKey(key)) {
  range = new Range(range.getEndKey(), true, range.getEndKey(), range.isEndKeyInclusive());
  source.seek(range, columnFamilies, inclusive);
 } else {
  range = new Range(key, true, range.getEndKey(), range.isEndKeyInclusive());
  source.seek(range, columnFamilies, inclusive);
 }
}

代码示例来源:origin: apache/accumulo

private void reseek(Key key) throws IOException {
 if (range.afterEndKey(key)) {
  range = new Range(range.getEndKey(), true, range.getEndKey(), range.isEndKeyInclusive());
  source.seek(range, colFamSet, inclusive);
 } else {
  range = new Range(key, true, range.getEndKey(), range.isEndKeyInclusive());
  source.seek(range, colFamSet, inclusive);
 }
}

代码示例来源:origin: apache/accumulo

|| range.afterEndKey(new Key(extent.getEndRow()).followingKey(PartialKey.ROW))) {
break;

代码示例来源:origin: apache/accumulo

protected void reseek(Key key) throws IOException {
 if (key == null)
  return;
 if (range.afterEndKey(key)) {
  range = new Range(range.getEndKey(), true, range.getEndKey(), range.isEndKeyInclusive());
  getSource().seek(range, columnFamilies, inclusive);
 } else {
  range = new Range(key, true, range.getEndKey(), range.isEndKeyInclusive());
  getSource().seek(range, columnFamilies, inclusive);
 }
}

代码示例来源:origin: apache/accumulo

@Override
protected void consume() throws IOException {
 if (finished || lastRowFound == null)
  return;
 int count = 0;
 SortedKeyValueIterator<Key,Value> source = getSource();
 while (source.hasTop() && lastRowFound.equals(source.getTopKey().getRow())) {
  // try to efficiently jump to the next matching key
  if (count < numscans) {
   ++count;
   source.next(); // scan
  } else {
   // too many scans, just seek
   count = 0;
   // determine where to seek to, but don't go beyond the user-specified range
   Key nextKey = source.getTopKey().followingKey(PartialKey.ROW);
   if (!latestRange.afterEndKey(nextKey))
    source.seek(
      new Range(nextKey, true, latestRange.getEndKey(), latestRange.isEndKeyInclusive()),
      latestColumnFamilies, latestInclusive);
   else {
    finished = true;
    break;
   }
  }
 }
 lastRowFound = source.hasTop() ? source.getTopKey().getRow(lastRowFound) : null;
}

代码示例来源:origin: apache/accumulo

if (range.afterEndKey(new Key(currentExtent.getEndRow()).followingKey(PartialKey.ROW))) {
 iter = null;
 return;

代码示例来源:origin: apache/accumulo

ski = isStartKeyInclusive();
} else if (afterEndKey(range.getStartKey())
  || (getEndKey() != null && range.getStartKey().equals(getEndKey())
    && !(range.isStartKeyInclusive() && isEndKeyInclusive()))) {
  return null;
 throw new IllegalArgumentException("Range " + range + " does not overlap " + this);
} else if (afterEndKey(range.getEndKey())) {
 ek = getEndKey();
 eki = isEndKeyInclusive();

相关文章