{"record":{"id":"b16adb846d1a958a","repo":"prestodb/presto","slug":"not-supported-b16adb","errorCode":"NOT_SUPPORTED","errorMessage":"Create Function is not supported in NativeFunctionNamespaceManager","messagePattern":"Create Function is not supported in NativeFunctionNamespaceManager","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/functionNamespace/NativeFunctionNamespaceManager.java","lineNumber":200,"sourceCode":"    protected FunctionMetadata fetchFunctionMetadataDirect(SqlFunctionHandle functionHandle)\n    {\n        checkArgument(functionHandle instanceof NativeFunctionHandle, \"Unsupported FunctionHandle type '%s'\", functionHandle.getClass().getSimpleName());\n        return getMetadataFromNativeFunctionHandle(functionHandle);\n    }\n\n    @Override\n    protected ScalarFunctionImplementation fetchFunctionImplementationDirect(SqlFunctionHandle functionHandle)\n    {\n        return fetchFunctionsDirect(functionHandle.getFunctionId().getFunctionName()).stream()\n                .filter(function -> function.getRequiredFunctionHandle().equals(functionHandle))\n                .map(this::sqlInvokedFunctionToImplementation)\n                .collect(onlyElement());\n    }\n\n    @Override\n    public synchronized void createFunction(SqlInvokedFunction function, boolean replace)\n    {\n        throw new PrestoException(NOT_SUPPORTED, \"Create Function is not supported in NativeFunctionNamespaceManager\");\n    }\n\n    @Override\n    public void alterFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, AlterRoutineCharacteristics alterRoutineCharacteristics)\n    {\n        throw new PrestoException(NOT_SUPPORTED, \"Alter Function is not supported in NativeFunctionNamespaceManager\");\n    }\n\n    @Override\n    public void dropFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists)\n    {\n        throw new PrestoException(NOT_SUPPORTED, \"Drop Function is not supported in NativeFunctionNamespaceManager\");\n    }\n\n    @Override\n    public Collection<SqlInvokedFunction> listFunctions(Optional<String> likePattern, Optional<String> escape)\n    {\n        return memoizedFunctionsSupplier.get().values();","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/functionNamespace/NativeFunctionNamespaceManager.java#L182-L218","documentation":"NativeFunctionNamespaceManager is a read-only view of functions loaded from the native sidecar; it implements FunctionNamespaceManager but does not support mutating the function catalog. Any attempt to create a SQL invoked function through this namespace throws NOT_SUPPORTED.","triggerScenarios":"Calling createFunction(SqlInvokedFunction, replace) on the native function namespace, e.g. executing CREATE FUNCTION SQL against a catalog whose function namespace is the native sidecar manager.","commonSituations":"User runs CREATE FUNCTION on a catalog configured to use presto-native-sidecar-plugin; tooling that auto-registers UDFs; migration scripts from JDBC/SQL-server function namespaces applied to native catalogs.","solutions":["Do not issue CREATE FUNCTION against catalogs using NativeFunctionNamespaceManager.","Register the function in the source that feeds the sidecar (e.g. the native function bundle/registry), not via SQL.","Use a different function namespace (e.g. the SQL server-backed one) if function DDL is required."],"exampleFix":"// before\nCREATE FUNCTION mycatalog.ns.double_it(x BIGINT) RETURNS BIGINT ...\n// after: register the UDF in the native sidecar function registry, then reference it\nSELECT ns.double_it(42);","handlingStrategy":"validation","validationCode":"if (functionNamespaceManager instanceof NativeFunctionNamespaceManager) {\n    throw new IllegalStateException(\"CREATE FUNCTION not supported; register UDF in the native sidecar registry instead\");\n}","typeGuard":"boolean supportsFunctionDdl(FunctionNamespaceManager mgr) { return !(mgr instanceof NativeFunctionNamespaceManager); }","tryCatchPattern":"try { manager.createFunction(fn, false); }\ncatch (PrestoException e) { if (\"NOT_SUPPORTED\".equals(e.getErrorCode().getName())) { routeToNativeRegistry(fn); } else throw e; }","preventionTips":["Check the function namespace type before issuing function DDL","Document native catalogs as read-only for functions","Automate UDF registration through the sidecar native registry pipeline"],"tags":["not-supported","function-namespace","presto"],"backgroundTag":"operation-not-supported","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"}