{"record":{"id":"bb1d4c2e63bb12ab","repo":"prestodb/presto","slug":"too-large-expected-expected-elements-with","errorCode":null,"errorMessage":"Too large (\" + expected + \" expected elements with load factor \" + f + \")","messagePattern":"Too large \\(\" \\+ expected \\+ \" expected elements with load factor \" \\+ f \\+ \"\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-common/src/main/java/com/facebook/presto/common/array/Long2IntOpenHashMap.java","lineNumber":263,"sourceCode":"    }\n\n    private int removeEntry(int pos)\n    {\n        int oldValue = value[pos];\n        --size;\n        shiftKeys(pos);\n        if (n > minN && size < maxFill / 4 && n > 16) {\n            rehash(n / 2);\n        }\n\n        return oldValue;\n    }\n\n    private static int arraySize(int expected, float f)\n    {\n        long s = max(2L, nextPowerOfTwo((long) ceil((double) ((float) expected / f))));\n        if (s > 1073741824L) {\n            throw new IllegalArgumentException(\"Too large (\" + expected + \" expected elements with load factor \" + f + \")\");\n        }\n        else {\n            return (int) s;\n        }\n    }\n\n    private static int maxFill(int n, float f)\n    {\n        return min((int) ceil((double) ((float) n * f)), n - 1);\n    }\n\n    public static long mix(long x)\n    {\n        long h = x * -7046029254386353131L;\n        h ^= h >>> 32;\n        return h ^ h >>> 16;\n    }\n","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common/src/main/java/com/facebook/presto/common/array/Long2IntOpenHashMap.java#L245-L281","documentation":"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.","triggerScenarios":"Thrown at presto-common/src/main/java/com/facebook/presto/common/array/Long2IntOpenHashMap.java:263 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the number of expected elements stored in one map","Partition data across multiple map instances","Raise the load factor if appropriate to shrink the required array"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}