@Override
 public void init(
     SortedKeyValueIterator<Key, Value> source,
     Map<String, String> options,
     IteratorEnvironment env)
     throws IOException {
   super.init(source, options, env);
   validateOptions(options);
   sum = 0;
   hasTop = false;
 }
  @Override
  public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
      throws IOException {
    super.seek(range, columnFamilies, inclusive);

    if (!super.hasTop()) {
      return;
    }

    do {
      topKey = super.getTopKey();
      if (!topKey.isDeleted()) {
        topValue = super.getTopValue();
        sum += encoder.decode(super.getTopValue().get());
      }
      super.next();
    } while (super.hasTop());

    topValue = new Value(encoder.encode(sum));
    hasTop = true;
  }