热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

本文整理了Java中org.apache.accumulo.core.data.Range.isEndKeyInclusive方法的一些代码示例,展示了Ra

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

Range.isEndKeyInclusive介绍

[英]Gets whether the end key of this range is inclusive.
[中]获取此范围的结束键是否包含。

代码示例

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

private void _switchNow() throws IOException {
if (onlySwitchAfterRow)
throw new IllegalStateException("Can only switch on row boundries");
if (switchSource()) {
if (key != null) {
iter.seek(new Range(key, true, range.getEndKey(), range.isEndKeyInclusive()),
columnFamilies, inclusive);
}
}
}

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

static void trackScanning(Map> failures,
Map> unscanned, MultiScanResult scanResult) {
// translate returned failures, remove them from unscanned, and add them to failures
Map> 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 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 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

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

@Override
public boolean getCandidates(String continuePoint, List result)
throws TableNotFoundException {
// want to ensure GC makes progress... if the 1st N deletes are stable and we keep processing
// them,
// then will never inspect deletes after N
Range range = MetadataSchema.DeletesSection.getRange();
if (continuePoint != null && !continuePoint.isEmpty()) {
String cOntinueRow= MetadataSchema.DeletesSection.getRowPrefix() + continuePoint;
range = new Range(new Key(continueRow).followingKey(PartialKey.ROW), true,
range.getEndKey(), range.isEndKeyInclusive());
}
Scanner scanner = getClient().createScanner(tableName, Authorizations.EMPTY);
scanner.setRange(range);
result.clear();
// find candidates for deletion; chop off the prefix
for (Entry entry : scanner) {
String cand = entry.getKey().getRow().toString()
.substring(MetadataSchema.DeletesSection.getRowPrefix().length());
result.add(cand);
if (almostOutOfMemory(Runtime.getRuntime())) {
log.info("List of delete candidates has exceeded the memory"
+ " threshold. Attempting to delete what has been gathered so far.");
return true;
}
}
return false;
}

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

private void addUnfinishedRange(LookupResult lookupResult, Range range, Key key,
boolean inclusiveStartKey) {
if (range.getEndKey() == null || key.compareTo(range.getEndKey()) <0) {
Range nlur = new Range(new Key(key), inclusiveStartKey, range.getEndKey(),
range.isEndKeyInclusive());
lookupResult.unfinishedRanges.add(nlur);
}
}

代码示例来源: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

private void resetSource() {
if (prevTablet == null) {
source = iteratorFactory.apply(range);
} else {
// get the metadata table row for the previous tablet
Text prevMetaRow = TabletsSection.getRow(prevTablet.getTableId(), prevTablet.getEndRow());
// ensure the previous tablet still exists in the metadata table
if (Iterators.size(iteratorFactory.apply(new Range(prevMetaRow))) == 0) {
throw new TabletDeletedException("Tablet " + prevMetaRow + " was deleted while iterating");
}
// start scanning at next possible row in metadata table
Range seekRange = new Range(new Key(prevMetaRow).followingKey(PartialKey.ROW), true,
range.getEndKey(), range.isEndKeyInclusive());
log.info("Resetting scanner to {}", seekRange);
source = iteratorFactory.apply(seekRange);
}
}

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

TreeMap consumeMany(Collection> iterators,
Range range, Collection seekColumnFamilies, boolean seekInclusive)
throws IOException {
TreeMap data = new TreeMap<>();
// All of the copies should have consistent results from concurrent use
while (allHasTop(iterators)) {
// occasionally deep copy one of the existing iterators
if (random.nextInt(3) == 0) {
log.debug("Deep-copying and re-seeking an iterator");
SortedKeyValueIterator newcopy = getRandomElement(iterators)
.deepCopy(new SimpleIteratorEnvironment());
newcopy.seek(
new Range(getTopKey(iterators), true, range.getEndKey(), range.isEndKeyInclusive()),
seekColumnFamilies, seekInclusive);
// keep using the new one too, should act like the others
iterators.add(newcopy);
}
data.put(getTopKey(iterators), getTopValue(iterators));
next(iterators);
}
// All of the iterators should be consumed.
for (SortedKeyValueIterator iter : iterators) {
if (iter.hasTop()) {
return null;
}
}
return data;
}

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

public static Range maximizeStartKeyTimeStamp(Range range) {
Range seekRange = range;
if (range.getStartKey() != null) {
Key seekKey = range.getStartKey();
if (range.getStartKey().getTimestamp() != Long.MAX_VALUE) {
seekKey = new Key(seekRange.getStartKey());
seekKey.setTimestamp(Long.MAX_VALUE);
seekRange = new Range(seekKey, true, range.getEndKey(), range.isEndKeyInclusive());
} else if (!range.isStartKeyInclusive()) {
seekRange = new Range(seekKey, true, range.getEndKey(), range.isEndKeyInclusive());
}
}
return seekRange;
}

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

TreeMap consume(IteratorTestInput testInput, SortedKeyValueIterator skvi,
YieldCallback yield) throws IOException {
TreeMap data = new TreeMap<>();
Key lastKey = null;
while (yield.hasYielded() || skvi.hasTop()) {
if (yield.hasYielded()) {
Range r = testInput.getRange();
Key yieldPosition = yield.getPositionAndReset();
if (!r.contains(yieldPosition)) {
throw new IOException("Underlying iterator yielded to a position outside of its range: "
+ yieldPosition + " not in " + r);
}
if (skvi.hasTop()) {
throw new IOException(
"Underlying iterator reports having a top, but has yielded: " + yieldPosition);
}
if (lastKey != null && yieldPosition.compareTo(lastKey) <= 0) {
throw new IOException(
"Underlying iterator yielded at a position that is not past the last key returned");
}
skvi.seek(new Range(yieldPosition, false, r.getEndKey(), r.isEndKeyInclusive()),
testInput.getFamilies(), testInput.isInclusive());
} else {
// Make sure to copy the K-V
data.put(new Key(skvi.getTopKey()), new Value(skvi.getTopValue()));
skvi.next();
}
}
return data;
}

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

static boolean isRangeInBloomFilter(Range range, PartialKey keyDepth) {
if (range.getStartKey() == null || range.getEndKey() == null) {
return false;
}
if (range.getStartKey().equals(range.getEndKey(), keyDepth))
return true;
// include everything but the deleted flag in the comparison...
return range.getStartKey().followingKey(keyDepth).equals(range.getEndKey(),
PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME) && !range.isEndKeyInclusive();
}
}

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

/**
* Converts the given {@code Range} into the correct {@code Range} for this TermSource (per this
* expected table structure) and then seeks this TermSource's SKVI.
*/
public void seek(Range originalRange) throws IOException {
// the infinite start key is equivalent to a null startKey on the Range.
if (!originalRange.isInfiniteStartKey()) {
Key originalStartKey = originalRange.getStartKey();
// Pivot the provided range into the range for this term
Key newKey = new Key(originalStartKey.getRow(), term, originalStartKey.getColumnQualifier(),
originalStartKey.getTimestamp());
// Construct the new range, preserving the other attributes on the provided range.
currentRange = new Range(newKey, originalRange.isStartKeyInclusive(),
originalRange.getEndKey(), originalRange.isEndKeyInclusive());
} else {
currentRange = originalRange;
}
LOG.trace("Seeking {} to {}", this, currentRange);
iter.seek(currentRange, seekColfams, true);
}

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

@Override
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
throws Exception {
final String tableName = OptUtil.getTableOpt(cl, shellState);
final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
final Range range = getRange(cl, interpeter);
final Authorizations auths = getAuths(cl, shellState);
final Text startRow = range.getStartKey() == null ? null : range.getStartKey().getRow();
final Text endRow = range.getEndKey() == null ? null : range.getEndKey().getRow();
try {
final Text max = shellState.getAccumuloClient().tableOperations().getMaxRow(tableName, auths,
startRow, range.isStartKeyInclusive(), endRow, range.isEndKeyInclusive());
if (max != null) {
shellState.getReader().println(max.toString());
}
} catch (Exception e) {
log.debug("Could not get shell state.", e);
}
return 0;
}

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

public static Range minimizeEndKeyTimeStamp(Range range) {
Range seekRange = range;
if (range.getEndKey() != null) {
Key seekKey = seekRange.getEndKey();
if (range.getEndKey().getTimestamp() != Long.MIN_VALUE) {
seekKey = new Key(seekRange.getEndKey());
seekKey.setTimestamp(Long.MIN_VALUE);
seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true);
} else if (!range.isEndKeyInclusive()) {
seekRange = new Range(range.getStartKey(), range.isStartKeyInclusive(), seekKey, true);
}
}
return seekRange;
}

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

@Override
protected void consume() throws IOException {
if (finished || lastRowFound == null)
return;
int count = 0;
SortedKeyValueIterator source = getSource();
while (source.hasTop() && lastRowFound.equals(source.getTopKey().getRow())) {
// try to efficiently jump to the next matching key
if (count ++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

/**
* Possibly expand {@code range} to include everything for the key prefix we are working with.
* That is, if our prefix is ROW_COLFAM, then we need to expand the range so we're sure to include
* all entries having the same row and column family as the start/end of the range.
*
* @param range
* the range to expand
* @return the modified range
*/
protected Range computeReseekRange(Range range) {
Key startKey = range.getStartKey();
boolean startKeyInclusive = range.isStartKeyInclusive();
// If anything after the prefix is set, then clip the key so we include
// everything for the prefix.
if (isSetAfterPart(startKey, getKeyPrefix())) {
startKey = copyPartialKey(startKey, getKeyPrefix());
startKeyInclusive = true;
}
Key endKey = range.getEndKey();
boolean endKeyInclusive = range.isEndKeyInclusive();
if (isSetAfterPart(endKey, getKeyPrefix())) {
endKey = endKey.followingKey(getKeyPrefix());
endKeyInclusive = true;
}
return new Range(startKey, startKeyInclusive, endKey, endKeyInclusive);
}

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

@Override
public void seek(Range range, Collection columnFamilies, boolean inclusive)
throws IOException {
// save parameters for future internal seeks
latestRange = range;
latestColumnFamilies = columnFamilies;
latestInclusive = inclusive;
lastRowFound = null;
Key startKey = range.getStartKey();
Range seekRange = new Range(startKey == null ? null : new Key(startKey.getRow()), true,
range.getEndKey(), range.isEndKeyInclusive());
super.seek(seekRange, columnFamilies, inclusive);
finished = false;
if (getSource().hasTop()) {
lastRowFound = getSource().getTopKey().getRow();
if (range.beforeStartKey(getSource().getTopKey()))
consume();
}
}

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

@Override
public void seek(Range range, Collection columnFamilies, boolean inclusive)
throws IOException {
topKey = null;
topValue = null;
Key sk = range.getStartKey();
if (sk != null && 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/cf
Key followingRowKey = sk.followingKey(PartialKey.ROW_COLFAM);
if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0)
return;
range = new Range(sk.followingKey(PartialKey.ROW_COLFAM), true, range.getEndKey(),
range.isEndKeyInclusive());
}
sourceIter.seek(range, columnFamilies, inclusive);
prepKeys();
}

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

@Override
public void seek(Range range, Collection 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();
}

推荐阅读
  • Java程序设计第4周学习总结及注释应用的开发笔记
    本文由编程笔记#小编为大家整理,主要介绍了201521123087《Java程序设计》第4周学习总结相关的知识,包括注释的应用和使用类的注释与方法的注释进行注释的方法,并在Eclipse中查看。摘要内容大约为150字,提供了一定的参考价值。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • 标题: ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 本文介绍了Java中Hashtable的clear()方法,该方法用于清除和移除指定Hashtable中的所有键。通过示例程序演示了clear()方法的使用。 ... [详细]
  • 重入锁(ReentrantLock)学习及实现原理
    本文介绍了重入锁(ReentrantLock)的学习及实现原理。在学习synchronized的基础上,重入锁提供了更多的灵活性和功能。文章详细介绍了重入锁的特性、使用方法和实现原理,并提供了类图和测试代码供读者参考。重入锁支持重入和公平与非公平两种实现方式,通过对比和分析,读者可以更好地理解和应用重入锁。 ... [详细]
  • GreenDAO快速入门
    前言之前在自己做项目的时候,用到了GreenDAO数据库,其实对于数据库辅助工具库从OrmLite,到litePal再到GreenDAO,总是在不停的切换,但是没有真正去了解他们的 ... [详细]
  • HashMap的相关问题及其底层数据结构和操作流程
    本文介绍了关于HashMap的相关问题,包括其底层数据结构、JDK1.7和JDK1.8的差异、红黑树的使用、扩容和树化的条件、退化为链表的情况、索引的计算方法、hashcode和hash()方法的作用、数组容量的选择、Put方法的流程以及并发问题下的操作。文章还提到了扩容死链和数据错乱的问题,并探讨了key的设计要求。对于对Java面试中的HashMap问题感兴趣的读者,本文将为您提供一些有用的技术和经验。 ... [详细]
  • 本文介绍了在Android开发中使用软引用和弱引用的应用。如果一个对象只具有软引用,那么只有在内存不够的情况下才会被回收,可以用来实现内存敏感的高速缓存;而如果一个对象只具有弱引用,不管内存是否足够,都会被垃圾回收器回收。软引用和弱引用还可以与引用队列联合使用,当被引用的对象被回收时,会将引用加入到关联的引用队列中。软引用和弱引用的根本区别在于生命周期的长短,弱引用的对象可能随时被回收,而软引用的对象只有在内存不够时才会被回收。 ... [详细]
  • Hibernate延迟加载深入分析-集合属性的延迟加载策略
    本文深入分析了Hibernate延迟加载的机制,特别是集合属性的延迟加载策略。通过延迟加载,可以降低系统的内存开销,提高Hibernate的运行性能。对于集合属性,推荐使用延迟加载策略,即在系统需要使用集合属性时才从数据库装载关联的数据,避免一次加载所有集合属性导致性能下降。 ... [详细]
author-avatar
舞动青春的迪斯科舞厅
这个家伙很懒,什么也没留下!
RankList | 热门文章