prestodb/presto · error · IllegalStateException

Get function handle is not supported

Error message

Get function handle is not supported

What it means

getFunctionHandle() is an unsupported operation in the Hive function namespace manager. Signature-based function handle resolution is not implemented because Hive functions are resolved by qualified name plus parameter types via resolveFunction() instead. Throwing IllegalStateException makes accidental use fail fast.

Source

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

    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();
    }

    public ScalarFunctionImplementation getScalarFunctionImplementation(FunctionHandle functionHandle)
    {
        checkArgument(functionHandle instanceof HiveFunctionHandle);
        HiveFunction function = functions.getUnchecked(FunctionKey.from((HiveFunctionHandle) functionHandle));

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Call resolveFunction(transactionHandle, functionName, parameterTypes) instead, which builds a HiveFunctionHandle.
  2. Reconstruct the QualifiedObjectName and parameter type list and resolve by name.
  3. If signature-based resolution is needed, register the function in a namespace that supports it or implement a custom manager.

Example fix

// before
FunctionHandle h = manager.getFunctionHandle(txnHandle, signature);
// after
FunctionHandle h = manager.resolveFunction(txnHandle, qualifiedObjectName, parameterTypes);
Defensive patterns

Strategy: fallback

Validate before calling

if (manager instanceof HiveFunctionNamespaceManager) {
    // use resolveFunction(txn, qualifiedName, parameterTypes) instead of getFunctionHandle(sig)
}

Try / catch

try {
    handle = manager.getFunctionHandle(txnHandle, signature);
} catch (IllegalStateException e) {
    handle = manager.resolveFunction(txnHandle, qualifiedObjectName, parameterTypes);
}

Prevention

When it happens

Trigger: Calling getFunctionHandle(Optional<FunctionNamespaceTransactionHandle>, Signature) on HiveFunctionNamespaceManager, e.g. from generic engine code or a plugin that resolves functions by Signature.

Common situations: Migrating code that worked against other function namespaces which support signature-based resolution; test harnesses constructing FunctionHandles from raw signatures for 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/fef6d7c618078d5f. Report an issue: GitHub.