use of it.unimi.dsi.fastutil.ints.AbstractIntIterator in project presto by prestodb.
the class InMemoryHashAggregationBuilder method hashSortedGroupIds.
private IntIterator hashSortedGroupIds() {
IntBigArray groupIds = new IntBigArray();
groupIds.ensureCapacity(groupByHash.getGroupCount());
for (int i = 0; i < groupByHash.getGroupCount(); i++) {
groupIds.set(i, i);
}
groupIds.sort(0, groupByHash.getGroupCount(), (leftGroupId, rightGroupId) -> Long.compare(groupByHash.getRawHash(leftGroupId), groupByHash.getRawHash(rightGroupId)));
return new AbstractIntIterator() {
private final int totalPositions = groupByHash.getGroupCount();
private int position;
@Override
public boolean hasNext() {
return position < totalPositions;
}
@Override
public int nextInt() {
return groupIds.get(position++);
}
};
}
Aggregations