The segment operator is responsible for collecting all records that share the same values of the provided expressions and outputting them together as a single segment (or group) of data. Each record of the output segment will have the same value for all provided expressions. The segment operator will also output a segment key in the provided ref.
Optionally, a segment operator can receive an input segment key (within). In this case, each output segment will be limited by the provided input segment. The segment operator is stable. This means that all records within a segment will appear in the order that they appeared in the input. There is no guarantee, however, about the order that inner segments will be output.