Class ReducerStream

  • All Implemented Interfaces:
    Closeable, Serializable, AutoCloseable, Expressible, org.apache.solr.common.MapSerializable, org.apache.solr.common.MapWriter, org.apache.solr.common.NavigableObject, org.noggit.JSONWriter.Writable

    public class ReducerStream
    extends TupleStream
    implements Expressible
    Iterates over a TupleStream and buffers Tuples that are equal based on a comparator. This allows tuples to be grouped by common field(s).

    The read() method emits one tuple per group. The fields of the emitted Tuple reflect the first tuple encountered in the group.

    Use the Tuple.getMaps() method to return all the Tuples in the group. This method returns a list of maps (including the group head), which hold the data for each Tuple in the group.

    Note: The ReducerStream requires that it's underlying stream be sorted and partitioned by the same fields as it's comparator.

    Since:
    5.1.0
    See Also:
    Serialized Form