prestodb/presto · error · PrestoException

GENERIC_USER_ERROR

GENERIC_USER_ERROR

Error message

Catalog %s does not support functions implemented in language %s

What it means

checkFunctionLanguageSupported rejects a SQL-invoked function whose routine characteristics declare a language the catalog's configured SqlFunctionExecutors cannot execute. This is a GENERIC_USER_ERROR: the caller (CREATE FUNCTION) asked for something unsupported, e.g. declaring language 'PYTHON' on a catalog that only registers 'SQL' executors.

Source

Thrown at presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/AbstractSqlInvokedFunctionNamespaceManager.java:293

    protected void checkCatalog(CatalogSchemaName functionNamespace)
    {
        checkArgument(
                catalogName.equals(functionNamespace.getCatalogName()),
                "Catalog [%s] is not served by this FunctionNamespaceManager, expected: %s",
                functionNamespace.getCatalogName(),
                catalogName);
    }

    protected void refreshFunctionsCache(QualifiedObjectName functionName)
    {
        functions.refresh(functionName);
    }

    protected void checkFunctionLanguageSupported(SqlInvokedFunction function)
    {
        if (!sqlFunctionExecutors.getSupportedLanguages().contains(function.getRoutineCharacteristics().getLanguage())) {
            throw new PrestoException(GENERIC_USER_ERROR, format("Catalog %s does not support functions implemented in language %s", catalogName, function.getRoutineCharacteristics().getLanguage()));
        }
    }

    protected FunctionMetadata sqlInvokedFunctionToMetadata(SqlInvokedFunction function)
    {
        return new FunctionMetadata(
                function.getSignature().getName(),
                function.getSignature().getArgumentTypes(),
                function.getParameters().stream()
                        .map(Parameter::getName)
                        .collect(toImmutableList()),
                function.getSignature().getReturnType(),
                function.getSignature().getKind(),
                function.getRoutineCharacteristics().getLanguage(),
                getFunctionImplementationType(function),
                function.isDeterministic(),
                function.isCalledOnNullInput(),
                function.getVersion());

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Change the function's LANGUAGE to one listed in the catalog's supported languages (usually 'SQL').
  2. Install/enable the SPI plugin that registers an SqlFunctionExecutor for the desired language on the coordinator.
  3. Verify catalog configuration so the executor supporting the language is bound to this catalog.

Example fix

// before
CREATE FUNCTION my_ns.fn(x BIGINT) RETURNS BIGINT LANGUAGE PYTHON ...
// after
CREATE FUNCTION my_ns.fn(x BIGINT) RETURNS BIGINT LANGUAGE SQL RETURN x + 1
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = sqlFunctionExecutors.getSupportedLanguages();
if (!supported.contains(function.getRoutineCharacteristics().getLanguage())) {
    throw new IllegalArgumentException("Unsupported language: " + function.getRoutineCharacteristics().getLanguage());
}

Try / catch

try {
    manager.createFunction(function, replace);
} catch (PrestoException e) {
    if ("Catalog %s does not support functions".contains("language") || e.getErrorCode() == GENERIC_USER_ERROR.toErrorCode()) {
        // retry with LANGUAGE SQL
    }
}

Prevention

When it happens

Trigger: CREATE FUNCTION ... LANGUAGE <x> (or createFunction/replace via the namespace manager) where <x> is not in sqlFunctionExecutors.getSupportedLanguages() for this catalog.

Common situations: Typo in the LANGUAGE clause (e.g. 'sql' vs custom language name); migrating functions from a catalog that supports an external language (e.g. python/rpc) to one that does not; plugin providing the language executor not installed on the coordinator.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/98cac3e2e3690a0f. Report an issue: GitHub.