{"record":{"id":"cf697195d0e1104c","repo":"prestodb/presto","slug":"function-implementation-missing","errorCode":"FUNCTION_IMPLEMENTATION_MISSING","errorMessage":"%s not found","messagePattern":"(.+?) not found","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/metadata/BuiltInTypeAndFunctionNamespaceManager.java","lineNumber":1400,"sourceCode":"            String typeName = signature.getNameSuffix().substring(MAGIC_LITERAL_FUNCTION_PREFIX.length());\n\n            // lookup the type\n            Type type = functionAndTypeManager.getType(parseTypeSignature(typeName));\n\n            // verify we have one parameter of the proper type\n            checkArgument(parameterTypes.size() == 1, \"Expected one argument to literal function, but got %s\", parameterTypes);\n            Type parameterType = functionAndTypeManager.getType(parameterTypes.get(0));\n            requireNonNull(parameterType, format(\"Type %s not found\", parameterTypes.get(0)));\n\n            return new SpecializedFunctionKey(\n                    magicLiteralFunction,\n                    BoundVariables.builder()\n                            .setTypeVariable(\"T\", parameterType)\n                            .setTypeVariable(\"R\", type)\n                            .build(),\n                    1);\n        }\n        throw new PrestoException(FUNCTION_IMPLEMENTATION_MISSING, format(\"%s not found\", signature));\n    }\n\n    private static class EmptyTransactionHandle\n            implements FunctionNamespaceTransactionHandle\n    {\n    }\n\n    /**\n     * TypeSignature but has overridden equals(). Here, we compare exact signature of any underlying distinct\n     * types. Some distinct types may have extra information on their lazily loaded parents, and same parent\n     * information is compared in equals(). This is needed to cache types in parametricTypesCache.\n     */\n    private static class ExactTypeSignature\n    {\n        private final TypeSignature typeSignature;\n\n        public ExactTypeSignature(TypeSignature typeSignature)\n        {","sourceCodeStart":1382,"sourceCodeEnd":1418,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/metadata/BuiltInTypeAndFunctionNamespaceManager.java#L1382-L1418","documentation":"Magic-literal functions are special functions bound to literal values (e.g. timestamp literals, decimal literals). When the manager tries to specialize such a function for the given signature and no matching implementation can be bound, it throws FUNCTION_IMPLEMENTATION_MISSING, indicating no registered implementation matches the requested signature.","triggerScenarios":"Resolving a magic-literal function signature (e.g. a literal of a type with no registered magic-literal implementation) during function specialization in doGetSpecializedFunctionKeyForMagicLiteralFunctions.","commonSituations":"Using a literal with an unusual or unsupported type (e.g. very large decimal, exotic varchar literal in a context requiring magic literal resolution); custom type plugins that don't register magic-literal bindings.","solutions":["Cast the literal explicitly to a supported type instead of relying on magic-literal resolution.","Check registered magic-literal function bindings; ensure the plugin providing the type is installed.","Rewrite the query to avoid the unsupported literal type."],"exampleFix":"// before\nSELECT 9999999999999999999999999999999999DECIMAL(5);\n// after\nSELECT CAST('9999999999999999999999999999999999' AS DECIMAL(38,0));","handlingStrategy":"try-catch","validationCode":"// avoid raw literals that require magic-literal specialization; prefer explicit CAST:\n// CAST('123.45' AS DECIMAL(5,2)) instead of 123.45DECIMAL(5,2)","typeGuard":null,"tryCatchPattern":"try { resolveFunction(signature); }\ncatch (PrestoException e) { if (e.getErrorCode().toErrorCodeCode() == FUNCTION_IMPLEMENTATION_MISSING.toErrorCode().getCode()) { rewriteQueryWithExplicitCast(); } else throw e; }","preventionTips":["Use explicit CAST for literals with non-default types","Keep type plugins that register magic-literal functions installed","Test queries with exotic literal types in CI"],"tags":["presto","function-resolution","magic-literal","function-implementation-missing"],"backgroundTag":"function-implementation-missing","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"}