prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

Alter Function is not supported in JsonFileBasedFunctionNamespaceManager

What it means

Feature sentinel: the JSON-file function-namespace manager is read-mostly and does not implement ALTER FUNCTION; only CREATE (with replace semantics via createFunction) is supported against the JSON file.

Source

Thrown at presto-function-namespace-managers/src/main/java/com/facebook/presto/functionNamespace/json/JsonFileBasedFunctionNamespaceManager.java:348

    {
        checkFunctionLanguageSupported(function);
        SqlFunctionId functionId = function.getFunctionId();
        if (!replace && latestFunctions.containsKey(function.getFunctionId())) {
            throw new PrestoException(GENERIC_USER_ERROR, format("Function '%s' already exists", functionId.getId()));
        }

        SqlInvokedFunction replacedFunction = latestFunctions.get(functionId);
        long version = 1;
        if (replacedFunction != null) {
            version = parseLong(replacedFunction.getRequiredVersion()) + 1;
        }
        latestFunctions.put(functionId, function.withVersion(String.valueOf(version)));
    }

    @Override
    public void alterFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, AlterRoutineCharacteristics alterRoutineCharacteristics)
    {
        throw new PrestoException(NOT_SUPPORTED, "Alter Function is not supported in JsonFileBasedFunctionNamespaceManager");
    }

    @Override
    public void dropFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists)
    {
        throw new PrestoException(NOT_SUPPORTED, "Drop Function is not supported in JsonFileBasedFunctionNamespaceManager");
    }

    @Override
    public Collection<SqlInvokedFunction> listFunctions(Optional<String> likePattern, Optional<String> escape)
    {
        return latestFunctions.values();
    }

    @Override
    public void addUserDefinedType(UserDefinedType userDefinedType)
    {
        QualifiedObjectName name = userDefinedType.getUserDefinedTypeName();

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Edit the function definition JSON file and reload instead of using ALTER FUNCTION
  2. Use a function namespace manager that supports DDL (e.g. the REST/DB-backed manager)

Example fix

// before
manager.alterFunction(name, paramTypes, characteristics);
// after
manager.createFunction(updatedFunction, true);
Defensive patterns

Strategy: type-guard

Validate before calling

if (manager instanceof JsonFileBasedFunctionNamespaceManager) {
    throw new UnsupportedOperationException("alterFunction unsupported; use createFunction(replace=true)");
}

Try / catch

try {
    manager.alterFunction(name, types, chars);
} catch (PrestoException e) {
    if (isNotSupported(e)) { /* fall back to createFunction(replace=true) */ } else { throw e; }
}

Prevention

When it happens

Trigger: Calling alterFunction(functionName, parameterTypes, alterRoutineCharacteristics) on a catalog backed by JsonFileBasedFunctionNamespaceManager (e.g. issuing ALTER FUNCTION statements routed to this manager).

Common situations: Running ALTER FUNCTION ... SET CHARACTERISTICS / metadata SQL against a catalog configured with the JSON file namespace manager; migration scripts assuming MySQL-style manager features.

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/626ca821224a8b9c. Report an issue: GitHub.