Class GroupedTypedHistogram

java.lang.Object
io.trino.operator.aggregation.histogram.GroupedTypedHistogram
All Implemented Interfaces:
TypedHistogram

public class GroupedTypedHistogram extends Object implements TypedHistogram
implementation that uses groupId in the hash key, so that we may store all groupId x value -> count in one giant map. The value, however, is normalized into a single ValueBuilder. Further, we do not have per-group instances of objects. In order to construct a histogram for a group on demand, a linked list for each group is stored that overlays all virtual nodes (a shared index, i, across parallel arrays).

 eg,
 heads[100] -> 3

 means the first piece of data is (values[valuePositions[3]], counts[3])
 If next[3] is 10, then we look at (values[valuePositions[10]], counts[10])

 and so on to construct the value, count pairs needed. An iterator-style function, readAllValues, exists and the caller may do whatever want with the
 values.