protected void findTop() throws IOException { SortedKeyValueIterator<Key,Value> src = getSource(); // advance could be null if we've just been seeked advance = null; while (src.hasTop() && !advancedPastSeek) { if (src.getTopKey().isDeleted()) { // as per. o.a.a.core.iterators.Filter, deleted keys always pass through the filter. advance = AdvanceResult.NEXT; return; } FilterResult f = filter(src.getTopKey(), src.getTopValue()); if (log.isTraceEnabled()) { log.trace("Filtered: {} result == {} hint == {}", src.getTopKey(), f, f.advance == AdvanceResult.USE_HINT ? getNextKeyHint(src.getTopKey(), src.getTopValue()) : " (none)"); } if (f.accept != negate) { // advance will be processed when next is called advance = f.advance; break; } else { advanceSource(src, f.advance); } } }
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { CfCqSliceSeekingFilter o = (CfCqSliceSeekingFilter) super.deepCopy(env); o.cso = new CfCqSliceOpts(cso); return o; }
@Override public void next() throws IOException { advanceSource(getSource(), advance); findTop(); }
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { SeekingFilter newInstance; try { newInstance = this.getClass().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } newInstance.setSource(getSource().deepCopy(env)); newInstance.negate = negate; return newInstance; }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); cso = new CfCqSliceOpts(options); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { super.seek(range, columnFamilies, inclusive); advance = null; this.columnFamilies = columnFamilies; this.inclusive = inclusive; seekRange = range; advancedPastSeek = false; findTop(); }
case USE_HINT: Value topVal = src.getTopValue(); Key hintKey = getNextKeyHint(topKey, topVal); if (hintKey != null && hintKey.compareTo(topKey) > 0) { advRange = new Range(hintKey, null);
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { SeekingFilter newInstance; try { newInstance = this.getClass().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } newInstance.setSource(getSource().deepCopy(env)); newInstance.negate = negate; return newInstance; }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); cso = new CfCqSliceOpts(options); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { super.seek(range, columnFamilies, inclusive); advance = null; this.columnFamilies = columnFamilies; this.inclusive = inclusive; seekRange = range; advancedPastSeek = false; findTop(); }
case USE_HINT: Value topVal = src.getTopValue(); Key hintKey = getNextKeyHint(topKey, topVal); if (hintKey != null && hintKey.compareTo(topKey) > 0) { advRange = new Range(hintKey, null);
protected void findTop() throws IOException { SortedKeyValueIterator<Key,Value> src = getSource(); // advance could be null if we've just been seeked advance = null; while (src.hasTop() && !advancedPastSeek) { if (src.getTopKey().isDeleted()) { // as per. o.a.a.core.iterators.Filter, deleted keys always pass through the filter. advance = AdvanceResult.NEXT; return; } FilterResult f = filter(src.getTopKey(), src.getTopValue()); if (log.isTraceEnabled()) { log.trace("Filtered: {} result == {} hint == {}", src.getTopKey(), f, f.advance == AdvanceResult.USE_HINT ? getNextKeyHint(src.getTopKey(), src.getTopValue()) : " (none)"); } if (f.accept != negate) { // advance will be processed when next is called advance = f.advance; break; } else { advanceSource(src, f.advance); } } }
@Override public void next() throws IOException { advanceSource(getSource(), advance); findTop(); }
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { CfCqSliceSeekingFilter o = (CfCqSliceSeekingFilter) super.deepCopy(env); o.cso = new CfCqSliceOpts(cso); return o; }