@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { // TODO test Combiner newInstance; try { newInstance = this.getClass().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } newInstance.setSource(getSource().deepCopy(env)); newInstance.combiners = combiners; newInstance.combineAllColumns = combineAllColumns; newInstance.isMajorCompaction = isMajorCompaction; newInstance.reduceOnFullCompactionOnly = reduceOnFullCompactionOnly; return newInstance; }
/** * 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(); } } }
/** Marked final for safety. */ @Override protected final SortedKeyValueIterator<Key, Value> getSource() { return super.getSource(); }
@Override public SortedKeyValueIterator<Key,Value> deepCopy(IteratorEnvironment env) { // TODO test Combiner newInstance; try { newInstance = this.getClass().newInstance(); } catch (Exception e) { throw new RuntimeException(e); } newInstance.setSource(getSource().deepCopy(env)); newInstance.combiners = combiners; newInstance.combineAllColumns = combineAllColumns; newInstance.isMajorCompaction = isMajorCompaction; newInstance.reduceOnFullCompactionOnly = reduceOnFullCompactionOnly; return newInstance; }
/** * 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(); } } }