prestodb/presto · error · IllegalArgumentException

Too large (" + expected + " expected elements with load fact

Error message

Too large (" + expected + " expected elements with load factor " + f + ")

What it means

Hash-map sizing guard: the backing array size computed from the expected element count and load factor exceeds 2^30, which cannot be allocated as a Java int array, so the map cannot be constructed that large.

Source

Thrown at presto-common/src/main/java/com/facebook/presto/common/array/Long2IntOpenHashMap.java:263

    }

    private int removeEntry(int pos)
    {
        int oldValue = value[pos];
        --size;
        shiftKeys(pos);
        if (n > minN && size < maxFill / 4 && n > 16) {
            rehash(n / 2);
        }

        return oldValue;
    }

    private static int arraySize(int expected, float f)
    {
        long s = max(2L, nextPowerOfTwo((long) ceil((double) ((float) expected / f))));
        if (s > 1073741824L) {
            throw new IllegalArgumentException("Too large (" + expected + " expected elements with load factor " + f + ")");
        }
        else {
            return (int) s;
        }
    }

    private static int maxFill(int n, float f)
    {
        return min((int) ceil((double) ((float) n * f)), n - 1);
    }

    public static long mix(long x)
    {
        long h = x * -7046029254386353131L;
        h ^= h >>> 32;
        return h ^ h >>> 16;
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Reduce the number of expected elements stored in one map
  2. Partition data across multiple map instances
  3. Raise the load factor if appropriate to shrink the required array
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-common/src/main/java/com/facebook/presto/common/array/Long2IntOpenHashMap.java:263 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/bb1d4c2e63bb12ab. Report an issue: GitHub.