@Override public Value getTopValue() { if (topKey == null) return super.getTopValue(); return topValue; }
@Override public void next() throws IOException { super.next(); count++; }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { log.debug("{} seek({}, {}, {})", prefix, range, columnFamilies, inclusive); super.seek(range, columnFamilies, inclusive); }
private void getTopKeyVal() { Key k = super.getTopKey(); Value v = super.getTopValue(); if (k instanceof MemKey || k == null) { currKey = (MemKey) k; currVal = v; return; } MemValue mv = MemValue.decode(v); currVal = mv.value; currKey = new MemKey(k, mv.kvCount); }
@Override public Key getTopKey() { if (topKey == null) return super.getTopKey(); return topKey; }
@Override public boolean hasTop() { return hasTop && super.hasTop(); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { super.init(source, options, env); negate = Boolean.parseBoolean(options.get(NEGATE)); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { seekRange = new Range(range); seekColumnFamilies = columnFamilies; seekColumnFamiliesInclusive = inclusive; // Seek the source iterator, but use a recalculated range that ensures // we see all keys with the same "prefix." We need to do this since // transforming could change the sort order and transformed keys that // are before the range start could be inside the range after transformation. super.seek(computeReseekRange(range), untransformColumnFamilies(columnFamilies), inclusive); // Range clipping could cause us to trim out all the keys we transformed. // Keep looping until we either have some keys in the output range, or have // exhausted the source iterator. keyPos = -1; // “Clear” list so hasTop returns false to get us into the loop (transformKeys // actually clears) while (!hasTop() && super.hasTop()) { // Build up a sorted list of all keys for the same prefix. When // people ask for keys, return from this list first until it is empty // before incrementing the source iterator. transformKeys(); } }
/** * Sets the topKey and topValue based on the top key of the source. If the column of the source * top key is in the set of combiners, topKey will be the top key of the source and topValue will * be the result of the reduce method. Otherwise, topKey and topValue will be unchanged. (They are * always set to null before this method is called.) */ private void findTop() throws IOException { // check if aggregation is needed if (super.hasTop()) { workKey.set(super.getTopKey()); if (combineAllColumns || combiners.contains(workKey)) { if (workKey.isDeleted()) { sawDelete(); return; } topKey = workKey; Iterator<Value> viter = new ValueIterator(getSource()); topValue = reduce(topKey, viter); while (viter.hasNext()) viter.next(); } } }
private void getTopKeyVal() { Key k = super.getTopKey(); Value v = super.getTopValue(); if (k instanceof MemKey || k == null) { currKey = (MemKey) k; currVal = v; return; } MemValue mv = MemValue.decode(v); currVal = mv.value; currKey = new MemKey(k, mv.kvCount); }
@Override public Key getTopKey() { Key wc = super.getTopKey(); log.debug("{} getTopKey() --> {}", prefix, wc); return wc; }
@Override public boolean hasTop() { return hasTop && super.hasTop(); }
@Override public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> options, IteratorEnvironment env) throws IOException { log.debug("init({}, {}, {})", source, options, env); if (prefix == null) { prefix = String.format("0x%08X", this.hashCode()); } super.init(source, options, env); }
@Override public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException { range = rowRange.clip(range, true); if (range == null) { hasTop = false; } else { hasTop = true; super.seek(range, columnFamilies, inclusive); } } }
@Override public void next() throws IOException { super.next(); count++; if (count % 1024 == 0) { entriesRead.addAndGet(1024); } }
@Override public Value getTopValue() { Value w = super.getTopValue(); log.debug("{} getTopKey() --> {}", prefix, w); return w; }
private void getTopKeyVal() { Key k = super.getTopKey(); Value v = super.getTopValue(); if (k instanceof MemKey || k == null) { currKey = (MemKey) k; currVal = v; return; } currVal = new Value(v); int mc = MemValue.splitKVCount(currVal); currKey = new MemKey(k, mc); }
@Override public Key getTopKey() { if (null != errorKey) { returned = true; return errorKey; } else return super.getTopKey(); }
@Override public boolean hasTop() { return topKey != null || super.hasTop(); }