Have you looked into doing a custom iterator? Typically they are per table and work over the entire table, but can be used for filtering and aggregation in Accumulo.
http://accumulo.apache.org/notable_features.html - Basic Accumulo Explanation of an Iterator.
http://accumulo.net/iterators/overview - Explanation of how Accumulo Iterators work and includes and example with explanations.