/** * 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)); } }
/** * 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); }
@Override public void readFields(DataInput in) throws IOException { infiniteStartKey = in.readBoolean(); infiniteStopKey = in.readBoolean(); if (!infiniteStartKey) { start = new Key(); start.readFields(in); } else { start = null; } if (!infiniteStopKey) { stop = new Key(); stop.readFields(in); } else { stop = null; } startKeyInclusive = in.readBoolean(); stopKeyInclusive = in.readBoolean(); if (!infiniteStartKey && !infiniteStopKey && beforeStartKey(stop)) { throw new InvalidObjectException( "Start key must be less than end key in range (" + start + ", " + stop + ")"); } }
@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(); } }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { if (columnFamilies.size() != 0 || inclusive) { throw new IllegalArgumentException("I do not know how to filter column families"); } if (range == null) throw new IllegalArgumentException("Cannot seek to null range"); if (interruptFlag != null && interruptFlag.get()) throw new IterationInterruptedException(); Key key = range.getStartKey(); if (key == null) { key = new Key(); } reader.seek(key); while (hasTop() && range.beforeStartKey(getTopKey())) { next(); } }
while (currentPosition < keys.size() && range.beforeStartKey(keys.get(currentPosition))) currentPosition++;
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range); seekRange = IteratorUtil.minimizeEndKeyTimeStamp(seekRange); source.seek(seekRange, columnFamilies, inclusive); this.range = range; while (hasTop() && range.beforeStartKey(getTopKey())) { next(); } }
@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(); } }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { // do not want to seek to the middle of a row Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range); this.range = seekRange; this.columnFamilies = columnFamilies; this.inclusive = inclusive; super.seek(seekRange, columnFamilies, inclusive); resetVersionCount(); if (range.getStartKey() != null) while (hasTop() && range.beforeStartKey(getTopKey())) next(); }
@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(); } }
consumeEmptyColFams(); if (source.hasTop() && range.beforeStartKey(source.getTopKey())) { source.seek(range, columnFamilies, inclusive); consumeDeleted();
loc = null; } else if (scanState.range.getEndKey() != null && dataRange.beforeStartKey(scanState.range.getEndKey())) {
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { // do not want to seek to the middle of a row Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range); source.seek(seekRange, columnFamilies, inclusive); findTop(); if (range.getStartKey() != null) { while (source.hasTop() && source.getTopKey().compareTo(range.getStartKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME) < 0) { next(); } while (hasTop() && range.beforeStartKey(getTopKey())) { next(); } } }
/** * 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); }
@Override public void seek(Range range, Collection<ByteSequence> 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(); } }
return null; throw new IllegalArgumentException("Range " + range + " does not overlap " + this); } else if (beforeStartKey(range.getStartKey())) { sk = getStartKey(); ski = isStartKeyInclusive(); eki = isEndKeyInclusive(); } else if (beforeStartKey(range.getEndKey()) || (getStartKey() != null && range.getEndKey().equals(getStartKey()) && !(range.isEndKeyInclusive() && isStartKeyInclusive()))) {
@Override 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 combined... Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range); super.seek(seekRange, columnFamilies, inclusive); findTop(); if (range.getStartKey() != null) { while (hasTop() && getTopKey().equals(range.getStartKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS) && 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(); } } }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { lastKeySet = false; Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range); super.seek(seekRange, columnFamilies, inclusive); while (hasTop() && range.beforeStartKey(getTopKey())) { next(); } }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range); seekRange = IteratorUtil.minimizeEndKeyTimeStamp(seekRange); source.seek(seekRange, columnFamilies, inclusive); this.range = range; while (hasTop() && range.beforeStartKey(getTopKey())) { next(); } }
if (range.beforeStartKey(prevKey) && range.afterEndKey(getTopKey())) { while (hasTop() && range.beforeStartKey(getTopKey())) { next();