prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
Create Function is not supported in NativeFunctionNamespaceManager
What it means
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.
Source
Thrown at presto-native-sidecar-plugin/src/main/java/com/facebook/presto/sidecar/functionNamespace/NativeFunctionNamespaceManager.java:200
protected FunctionMetadata fetchFunctionMetadataDirect(SqlFunctionHandle functionHandle)
{
checkArgument(functionHandle instanceof NativeFunctionHandle, "Unsupported FunctionHandle type '%s'", functionHandle.getClass().getSimpleName());
return getMetadataFromNativeFunctionHandle(functionHandle);
}
@Override
protected ScalarFunctionImplementation fetchFunctionImplementationDirect(SqlFunctionHandle functionHandle)
{
return fetchFunctionsDirect(functionHandle.getFunctionId().getFunctionName()).stream()
.filter(function -> function.getRequiredFunctionHandle().equals(functionHandle))
.map(this::sqlInvokedFunctionToImplementation)
.collect(onlyElement());
}
@Override
public synchronized void createFunction(SqlInvokedFunction function, boolean replace)
{
throw new PrestoException(NOT_SUPPORTED, "Create Function is not supported in NativeFunctionNamespaceManager");
}
@Override
public void alterFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, AlterRoutineCharacteristics alterRoutineCharacteristics)
{
throw new PrestoException(NOT_SUPPORTED, "Alter Function is not supported in NativeFunctionNamespaceManager");
}
@Override
public void dropFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists)
{
throw new PrestoException(NOT_SUPPORTED, "Drop Function is not supported in NativeFunctionNamespaceManager");
}
@Override
public Collection<SqlInvokedFunction> listFunctions(Optional<String> likePattern, Optional<String> escape)
{
return memoizedFunctionsSupplier.get().values();View on GitHub (pinned to 55bb57d202)
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.
Example fix
// before CREATE FUNCTION mycatalog.ns.double_it(x BIGINT) RETURNS BIGINT ... // after: register the UDF in the native sidecar function registry, then reference it SELECT ns.double_it(42);
Defensive patterns
Strategy: validation
Validate before calling
if (functionNamespaceManager instanceof NativeFunctionNamespaceManager) {
throw new IllegalStateException("CREATE FUNCTION not supported; register UDF in the native sidecar registry instead");
} Type guard
boolean supportsFunctionDdl(FunctionNamespaceManager mgr) { return !(mgr instanceof NativeFunctionNamespaceManager); } Try / catch
try { manager.createFunction(fn, false); }
catch (PrestoException e) { if ("NOT_SUPPORTED".equals(e.getErrorCode().getName())) { routeToNativeRegistry(fn); } else throw e; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/b16adb846d1a958a.
Report an issue: GitHub.