use of it.unimi.dsi.fastutil.longs.Long2ShortRBTreeMap in project presto by prestodb.
the class SetDigest method newInstance.
public static SetDigest newInstance(Slice serialized) {
requireNonNull(serialized, "serialized is null");
SliceInput input = serialized.getInput();
checkArgument(input.readByte() == UNCOMPRESSED_FORMAT, "Unexpected version");
int hllLength = input.readInt();
Slice serializedHll = Slices.allocate(hllLength);
input.readBytes(serializedHll, hllLength);
HyperLogLog hll = HyperLogLog.newInstance(serializedHll);
Long2ShortRBTreeMap minhash = new Long2ShortRBTreeMap();
int maxHashes = input.readInt();
int minhashLength = input.readInt();
// The values are stored after the keys
SliceInput valuesInput = serialized.getInput();
valuesInput.setPosition(input.position() + minhashLength * SIZE_OF_LONG);
for (int i = 0; i < minhashLength; i++) {
minhash.put(input.readLong(), valuesInput.readShort());
}
return new SetDigest(maxHashes, hll, minhash);
}
Aggregations