prestodb/presto · error · IllegalStateException

Execute function is not supported

Error message

Execute function is not supported

What it means

executeFunction() is unsupported in the Hive function namespace: Hive functions are not executed remotely through the function-namespace execution path; their implementations are retrieved via specializedFunctionImplementation / getJavaScalarFunctionImplementation and run locally by the engine. This manager intentionally refuses remote function execution.

Source

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

    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));
        checkState(function instanceof HiveScalarFunction);
        return ((HiveScalarFunction) function).getJavaScalarFunctionImplementation();
    }

    @Override
    public CompletableFuture<SqlFunctionResult> executeFunction(String source, FunctionHandle functionHandle, Page input, List<Integer> channels, TypeManager typeManager)
    {
        throw new IllegalStateException("Execute function is not supported");
    }

    @Override
    public void addUserDefinedType(UserDefinedType userDefinedType)
    {
        throw new IllegalStateException("User defined type is not supported");
    }

    @Override
    public Optional<UserDefinedType> getUserDefinedType(QualifiedObjectName typeName)
    {
        throw new IllegalStateException("User defined type is not supported");
    }

    @Override
    public boolean canResolveFunction()
    {
        return true;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Use specializedFunctionImplementation(...) or getJavaScalarFunctionImplementation() to obtain the local implementation and invoke it directly.
  2. Ensure the function is resolved to a HiveFunctionHandle so the engine uses the local code path, not executeFunction.
  3. Implement a custom FunctionNamespaceManager overriding executeFunction if remote execution is genuinely required.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    return manager.executeFunction(source, handle, page, channels, typeManager);
} catch (IllegalStateException e) {
    // use local implementation instead
    ScalarFunctionImplementation impl = manager.getJavaScalarFunctionImplementation(handle);
    return invokeLocally(impl, page, channels);
}

Prevention

When it happens

Trigger: Calling executeFunction(String source, FunctionHandle, Page, List<Integer> channels, TypeManager) on the Hive function namespace manager, typically from code that invokes dynamic functions through the FunctionManager execution API.

Common situations: Custom connectors or plugins trying to execute Hive UDFs via the generic remote-execution interface; misconfigured function resolution routing Hive functions down the executeFunction path.

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