prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Add Function is yet to be added

What it means

RestBasedFunctionApis.addFunction is an intentionally unimplemented stub of the REST function-namespace client. It immediately throws NOT_SUPPORTED because the REST backend currently only exposes function reads (fetch), not writes. Any code path attempting to create a function through the REST manager hits this.

Source

Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/rest/RestBasedFunctionApis.java:88

    public UdfFunctionSignatureMap getAllFunctions()
    {
        return getFunctionsAt(ALL_FUNCTIONS_ENDPOINT);
    }

    public UdfFunctionSignatureMap getFunctions(String schema)
    {
        return getFunctionsAt(ALL_FUNCTIONS_ENDPOINT + "/" + schema);
    }

    public UdfFunctionSignatureMap getFunctions(String schema, String functionName)
    {
        return getFunctionsAt(ALL_FUNCTIONS_ENDPOINT + "/" + schema + "/" + functionName);
    }

    public String addFunction(String schema, String functionName, JsonBasedUdfFunctionMetadata metadata)
    {
        throw new PrestoException(NOT_SUPPORTED, "Add Function is yet to be added");
    }

    private UdfFunctionSignatureMap getFunctionsAt(String endpoint)
            throws IllegalStateException
    {
        try {
            URI uri = uriBuilderFrom(URI.create(restUrl))
                    .appendPath(endpoint)
                    .build();
            Request request = Request.builder()
                    .prepareGet()
                    .setUri(uri)
                    .build();

            Map<String, List<JsonBasedUdfFunctionMetadata>> nativeFunctionSignatureMap = httpClient.execute(request, createJsonResponseHandler(functionSignatureMapJsonCodec));
            return new UdfFunctionSignatureMap(ImmutableMap.copyOf(nativeFunctionSignatureMap));
        }
        catch (Exception e) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Create/manage the functions on the REST server side directly, not through Presto SQL DDL
  2. Keep UDF DDL on a writable manager (e.g. MySQL) and use the REST catalog only for read-only consumption
  3. Add the REST write endpoint and implement addFunction if you own the REST function server

Example fix

// before
-- run against REST-backed catalog
cREATE FUNCTION catalog.schema.fn(int) RETURNS int ...
// after
-- register fn via the REST server's own provisioning API/tooling instead
Defensive patterns

Strategy: try-catch

Validate before calling

// Detect unsupported REST manager before attempting DDL
if (manager instanceof RestBasedFunctionNamespaceManager) {
    throw new UnsupportedOperationException("Function creation not supported; provision via REST server");
}

Try / catch

try {
    manager.createFunction(function, false);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == NOT_SUPPORTED.toErrorCode().getCode()) {
        // fall back to REST-server-side provisioning
    } else throw e;
}

Prevention

When it happens

Trigger: Calling createFunction on a catalog configured with RestBasedFunctionNamespaceManager (whose restApis delegate to RestBasedFunctionApis.addFunction).

Common situations: Teams switching a catalog from MySqlFunctionNamespaceManager to the REST-based one and re-running the same CREATE FUNCTION scripts; automated pipelines that provision UDFs expecting write support.

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/864748f6cefbf92b. Report an issue: GitHub.