prestodb/presto · error · IllegalStateException

Get function is not supported

Error message

Get function is not supported

What it means

HiveFunctionNamespaceManager.getFunctions() is deliberately unimplemented for transactional lookups; the Hive function namespace only supports listing all functions and resolving functions by name, not fetching a single function by QualifiedObjectName via a transaction handle. The library throws IllegalStateException to signal the caller is using an API surface this namespace does not implement.

Solutions

  1. Use listFunctions() instead, which returns dummy HiveFunction instances for every current function name.
  2. Use resolveFunction(transactionHandle, QualifiedObjectName, parameterTypes) to obtain a FunctionHandle for a specific function.
  3. If name-based lookup is required, implement a custom FunctionNamespaceManager for the Hive functions rather than relying on this one.

Example fix

// before
Collection<? extends SqlFunction> fns = manager.getFunctions(txnHandle, QualifiedObjectName.valueOf("hive.default.my_func"));
// after
FunctionHandle handle = manager.resolveFunction(txnHandle, QualifiedObjectName.valueOf("hive.default.my_func"), parameterTypes);
Defensive patterns

Strategy: fallback

Validate before calling

if (manager instanceof HiveFunctionNamespaceManager) {
    // name-based getFunctions(txn, name) is unsupported; use listFunctions()/resolveFunction
}

Try / catch

try {
    return manager.getFunctions(txnHandle, name);
} catch (IllegalStateException e) {
    return manager.listFunctions().stream()
        .filter(f -> f.getFunctionMetadata().getName().getObjectName().equals(name.getObjectName()))
        .collect(toImmutableList());
}

Prevention

When it happens

Trigger: Calling getFunctions(Optional<FunctionNamespaceTransactionHandle>, QualifiedObjectName) on the Hive function namespace manager with a specific qualified object name.

Common situations: Plugin or connector code written against the generic FunctionNamespaceManager interface that assumes name-based function lookup works the same as in other namespaces (e.g. built-in SQL function namespace); custom integrations or tests invoking transactional lookups against Hive functions.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at presto-hive-function-namespace/src/main/java/com/facebook/presto/hive/functions/HiveFunctionNamespaceManager.java:141

    public void alterFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, AlterRoutineCharacteristics alterRoutineCharacteristics)
    {
        throw new IllegalStateException(format("Cannot alter function in hive function namespace: %s", functionName));
    }

    public void dropFunction(QualifiedObjectName functionName, Optional<List<TypeSignature>> parameterTypes, boolean exists)
    {
        throw new IllegalStateException(format("Cannot drop function in hive function namespace: %s", functionName));
    }

    @Override
    public Collection<HiveFunction> listFunctions(Optional<String> likePattern, Optional<String> escape)
    {
        return getCurrentFunctionNames().stream().map(functionName -> createDummyHiveFunction(functionName)).collect(toImmutableList());
    }

    public Collection<HiveFunction> getFunctions(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, QualifiedObjectName functionName)
    {
        throw new IllegalStateException("Get function is not supported");
    }

    public FunctionHandle getFunctionHandle(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, Signature signature)
    {
        throw new IllegalStateException("Get function handle is not supported");
    }

    public FunctionHandle resolveFunction(Optional<? extends FunctionNamespaceTransactionHandle> transactionHandle, QualifiedObjectName functionName, List<TypeSignature> parameterTypes)
    {
        return new HiveFunctionHandle(initializeFunction(FunctionKey.of(functionName, parameterTypes)).getSignature());
    }

    public FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle)
    {
        checkArgument(functionHandle instanceof HiveFunctionHandle);
        HiveFunction function = functions.getUnchecked(FunctionKey.from((HiveFunctionHandle) functionHandle));
        return function.getFunctionMetadata();
    }

View on GitHub (pinned to 55bb57d202)