{"record":{"id":"3991b662c03ef5b7","repo":"prestodb/presto","slug":"invalid-function-argument-3991b6","errorCode":"INVALID_FUNCTION_ARGUMENT","errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/HyperLogLogUtils.java","lineNumber":68,"sourceCode":"    }\n\n    public static void mergeState(@AggregationState HyperLogLogState state, HyperLogLog input)\n    {\n        HyperLogLog previous = state.getHyperLogLog();\n        if (previous == null) {\n            state.setHyperLogLog(input);\n            state.addMemoryUsage(input.estimatedInMemorySize());\n        }\n        else {\n            state.addMemoryUsage(-previous.estimatedInMemorySize());\n            try {\n                // Throws if the bucket counts are different.\n                // We currently cannot access these counts from HLL so we must\n                // catch and rethrow a more useful exception\n                previous.mergeWith(input);\n            }\n            catch (IllegalArgumentException e) {\n                throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e.getMessage(), e);\n            }\n            state.addMemoryUsage(previous.estimatedInMemorySize());\n        }\n    }\n\n    private static int log2Ceiling(int value)\n    {\n        return Integer.highestOneBit(value - 1) << 1;\n    }\n}\n","sourceCodeStart":50,"sourceCodeEnd":79,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/HyperLogLogUtils.java#L50-L79","documentation":"Catch-and-rethrow in HyperLogLogUtils.mergeState: merging two HyperLogLogs whose bucket counts differ throws inside the library; because the counts are not accessible, the original exception is rethrown with its raw message (hence the generic 'e.getMessage()' text) as INVALID_FUNCTION_ARGUMENT.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/HyperLogLogUtils.java:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure all HLL inputs to the merge/union were created with the same number of buckets","Create HLLs from the same engine/version with identical index configurations","Rebuild the HLLs from raw data with matching bucket counts before merging"],"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"}