presto-orc/src/main/java/io/prestosql/orc/writer/DictionaryBuilder.java/DictionaryBuilder/DictionaryBuilder
class DictionaryBuilder:    public DictionaryBuilder(int expectedSize)
    {
        checkArgument(expectedSize >= 0, "expectedSize must not be negative");

        // todo we can do better
        int expectedEntries = min(expectedSize, DEFAULT_MAX_PAGE_SIZE_IN_BYTES / EXPECTED_BYTES_PER_ENTRY);
        // it is guaranteed expectedEntries * EXPECTED_BYTES_PER_ENTRY will not overflow
        this.elementBlock = new VariableWidthBlockBuilder(
                null,
                expectedEntries,
                expectedEntries * EXPECTED_BYTES_PER_ENTRY);

        // first position is always null
        this.elementBlock.appendNull();

        int hashSize = arraySize(expectedSize, FILL_RATIO);
        this.maxFill = calculateMaxFill(hashSize);
        this.hashMask = hashSize - 1;

        blockPositionByHash.ensureCapacity(hashSize);
        blockPositionByHash.fill(EMPTY_SLOT);

        this.containsNullElement = false;
    }