Class HashUtil
- java.lang.Object
-
- io.prestosql.operator.aggregation.histogram.HashUtil
-
public final class HashUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
calculateMaxFill(int bucketCount, float fillRatio)
static int
computeBucketCount(int expectedSize, float fillRatio)
uses HashCommon.arraySize() which does this calculation.static int
nextBucketId(int bucketId, int mask, int probe)
static int
nextProbeLinear(int probeCount)
static int
nextSumOfCount(int probeCount)
static int
nextSumOfSquares(int probeCount)
-
-
-
Method Detail
-
nextProbeLinear
public static int nextProbeLinear(int probeCount)
-
nextSumOfCount
public static int nextSumOfCount(int probeCount)
-
nextSumOfSquares
public static int nextSumOfSquares(int probeCount)
-
nextBucketId
public static int nextBucketId(int bucketId, int mask, int probe)
- Parameters:
bucketId
- - previous bucketId locationmask
- - mask being used (typically # of buckets-1; due to power-of-2 sized bucket arrays, handles wrap-aroundprobe
- - how many buckets to jump to find next bucket- Returns:
- next bucketId, including any necessary wrap-around (again mask handles this)
-
calculateMaxFill
public static int calculateMaxFill(int bucketCount, float fillRatio)
-
computeBucketCount
public static int computeBucketCount(int expectedSize, float fillRatio)
uses HashCommon.arraySize() which does this calculation. this is just a wrapper to name the use of this case- Parameters:
expectedSize
- - expected number of elements to store in the hashfillRatio
- - expected fill ratio of buckets by elemements- Returns:
- nextPowerOfTwo(expectedSize / fillRatio)
-
-