{"record":{"id":"6520e9c7bc85a44d","repo":"prestodb/presto","slug":"ambiguous-function-call-6520e9","errorCode":"AMBIGUOUS_FUNCTION_CALL","errorMessage":"Function '%s' has two matching signatures. Please specify parameter types. \nFirst match : '%s', Second match: '%s'","messagePattern":"Function '(.+?)' has two matching signatures\\. Please specify parameter types\\. \nFirst match : '(.+?)', Second match: '(.+?)'","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java","lineNumber":1173,"sourceCode":"            matchingWorkerFunctionSignature =\n                    getMatchingFunction(workerCandidates, parameterTypes, coercionAllowed);\n            if (matchingWorkerFunctionSignature.isPresent()) {\n                foundMatch = true;\n            }\n        }\n        catch (SemanticException e) {\n            exceptions.add(e);\n        }\n\n        if (!foundMatch && !exceptions.isEmpty()) {\n            decideAndThrow(exceptions,\n                    allCandidates.stream().findFirst()\n                            .map(function -> function.getSignature().getName().getObjectName())\n                            .orElse(\"\"));\n        }\n\n        if (matchingDefaultFunctionSignature.isPresent() && matchingPluginFunctionSignature.isPresent()) {\n            throw new PrestoException(AMBIGUOUS_FUNCTION_CALL, format(\"Function '%s' has two matching signatures. Please specify parameter types. \\n\" +\n                    \"First match : '%s', Second match: '%s'\", functionName, matchingDefaultFunctionSignature.get(), matchingPluginFunctionSignature.get()));\n        }\n\n        if (matchingDefaultFunctionSignature.isPresent() && matchingWorkerFunctionSignature.isPresent()) {\n            FunctionHandle defaultFunctionHandle = functionNamespaceManager.getFunctionHandle(transactionHandle, matchingDefaultFunctionSignature.get());\n            FunctionHandle workerFunctionHandle = builtInWorkerFunctionNamespaceManager.getFunctionHandle(transactionHandle, matchingWorkerFunctionSignature.get());\n\n            if (functionNamespaceManager.getFunctionMetadata(defaultFunctionHandle).getImplementationType().equals(FunctionImplementationType.JAVA)) {\n                return defaultFunctionHandle;\n            }\n            if (functionNamespaceManager.getFunctionMetadata(defaultFunctionHandle).getImplementationType().equals(FunctionImplementationType.SQL)) {\n                return workerFunctionHandle;\n            }\n        }\n\n        if (matchingPluginFunctionSignature.isPresent() && matchingWorkerFunctionSignature.isPresent()) {\n            // built in plugin function namespace manager always has SQL as implementation type\n            return builtInWorkerFunctionNamespaceManager.getFunctionHandle(transactionHandle, matchingWorkerFunctionSignature.get());","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/metadata/FunctionAndTypeManager.java#L1155-L1191","documentation":"When both the default (builtin) namespace and the plugin namespace contain a matching overload for the same function call, Presto refuses to silently pick one and throws AMBIGUOUS_FUNCTION_CALL listing both matching signatures, asking the user to specify parameter types.","triggerScenarios":"resolveFunction path where matchingDefaultFunctionSignature and matchingPluginFunctionSignature are both present — i.e., the same function name/arity is registered in both builtin and plugin namespaces and both match the given argument types.","commonSituations":"A plugin registers a function whose name collides with a builtin (e.g. after a Presto upgrade added the builtin); shadowed function names across plugin versions; user SQL calls the colliding name without disambiguation.","solutions":["Qualify the call to the intended namespace/catalog.schema so only one candidate matches","Add explicit CASTs on arguments to steer matching to a single signature","Rename/unregister the plugin function that collides with the builtin","Upgrade or downgrade the plugin so it no longer duplicates the builtin"],"exampleFix":"// before\nSELECT greatest(1, 2) -- matches builtin AND plugin 'greatest'\n// after\nSELECT builtin.default.greatest(1, 2) -- or uninstall the colliding plugin function","handlingStrategy":"validation","validationCode":"// before calling, fully qualify the function name with its namespace so only one candidate can match","typeGuard":null,"tryCatchPattern":"try { fam.resolveFunction(name, types); } catch (PrestoException e) { if (e.getErrorCode().getCode() == AMBIGUOUS_FUNCTION_CALL) { /* read both signatures from message and disambiguate via casts or qualification */ } }","preventionTips":["Avoid plugin functions that shadow builtin names","Qualify function names when collisions are possible","Audit plugin registrations against builtin function names after upgrades"],"tags":["presto","ambiguity","function-resolution","namespace-collision"],"backgroundTag":"ambiguous-function-call","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"}