{"record":{"id":"f8f7ab90366974a3","repo":"prestodb/presto","slug":"ambiguous-function-call-f8f7ab","errorCode":"AMBIGUOUS_FUNCTION_CALL","errorMessage":"Ambiguous function call (%s) for %s","messagePattern":"Ambiguous function call \\((.+?)\\) for (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ParametricAggregation.java","lineNumber":163,"sourceCode":"    }\n\n    @Override\n    public boolean isCalledOnNullInput()\n    {\n        return details.isCalledOnNullInput();\n    }\n\n    private AggregationImplementation findMatchingImplementation(Signature boundSignature, BoundVariables variables, FunctionAndTypeManager functionAndTypeManager)\n    {\n        Optional<AggregationImplementation> foundImplementation = Optional.empty();\n        if (implementations.getExactImplementations().containsKey(boundSignature)) {\n            foundImplementation = Optional.of(implementations.getExactImplementations().get(boundSignature));\n        }\n        else {\n            for (AggregationImplementation candidate : implementations.getGenericImplementations()) {\n                if (candidate.areTypesAssignable(boundSignature, variables, functionAndTypeManager)) {\n                    if (foundImplementation.isPresent()) {\n                        throw new PrestoException(AMBIGUOUS_FUNCTION_CALL, format(\"Ambiguous function call (%s) for %s\", variables, getSignature()));\n                    }\n                    foundImplementation = Optional.of(candidate);\n                }\n            }\n        }\n\n        if (!foundImplementation.isPresent()) {\n            throw new PrestoException(FUNCTION_IMPLEMENTATION_MISSING, format(\"Unsupported type parameters (%s) for %s\", variables, getSignature()));\n        }\n        return foundImplementation.get();\n    }\n\n    private static AccumulatorStateSerializer<?> getAccumulatorStateSerializer(AggregationImplementation implementation, BoundVariables variables, FunctionAndTypeManager functionAndTypeManager, Class<?> stateClass, DynamicClassLoader classLoader)\n    {\n        AccumulatorStateSerializer<?> stateSerializer;\n        Optional<MethodHandle> stateSerializerFactory = implementation.getStateSerializerFactory();\n        if (stateSerializerFactory.isPresent()) {\n            try {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ParametricAggregation.java#L145-L181","documentation":"Specialization failure in ParametricAggregation.findMatchingImplementation: for the bound type arguments, more than one generic aggregation implementation matches the signature, so the engine cannot choose one deterministically.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/operator/aggregation/ParametricAggregation.java:163 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the aggregation's generic implementations mutually exclusive in their type constraints","Add explicit exact implementations for the problematic type binding","Report as a function-implementation bug if the function is built-in"],"exampleFix":null,"handlingStrategy":"type-guard","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"}