prestodb/presto · error · IllegalStateException

Get function metadata is not supported

Error message

Get function metadata is not supported

What it means

This comes from an internal dummy HiveFunction subclass whose getFunctionMetadata() is intentionally unimplemented. These placeholder functions exist solely so listFunctions() can report function names; their metadata is never expected to be requested. Requesting metadata from a dummy function is a programming error and throws IllegalStateException.

Source

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

    @Override
    public String getCatalogName()
    {
        return catalogName;
    }

    private static class DummyHiveFunction
            extends HiveFunction
    {
        public DummyHiveFunction(Signature signature)
        {
            super(signature.getName(), signature, false, true, true, "");
        }

        @Override
        public FunctionMetadata getFunctionMetadata()
        {
            throw new IllegalStateException("Get function metadata is not supported");
        }

        @Override
        public SqlFunctionVisibility getVisibility()
        {
            return PUBLIC;
        }
    }

    private static class EmptyTransactionHandle
            implements FunctionNamespaceTransactionHandle
    {
    }

    private static class FunctionKey
    {
        private final QualifiedObjectName name;
        private final List<TypeSignature> argumentTypes;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Do not call getFunctionMetadata() on functions from Hive listFunctions(); treat them as name-only placeholders.
  2. Obtain real metadata via getSpecializedFunctionMetadata(FunctionHandle) or resolveFunction first, then query the resolved function.
  3. Filter listFunctions() results to names and use the registry (StaticHiveFunctionRegistry) for actual function details.

Example fix

// before
for (var fn : manager.listFunctions()) {
    var meta = fn.getFunctionMetadata(); // throws for dummy functions
}
// after
for (var fn : manager.listFunctions()) {
    var name = fn.getFunctionMetadata().getName(); // or use fn.getSignature() name only
}
Defensive patterns

Strategy: type-guard

Validate before calling

// treat listFunctions() results as placeholders: only read name/signature, never metadata

Type guard

boolean isHiveDummyFunction(SqlFunction fn) {
    return fn instanceof HiveFunction && !fn.getSignature().getName().startsWith("$"); // resolve real metadata only for non-placeholder functions
}

Try / catch

try {
    meta = fn.getFunctionMetadata();
} catch (IllegalStateException e) {
    meta = manager.getSpecializedFunctionMetadata(handle); // resolve real metadata instead
}

Prevention

When it happens

Trigger: Calling getFunctionMetadata() on the dummy HiveFunction instances returned by HiveFunctionNamespaceManager.listFunctions() (created via createDummyHiveFunction).

Common situations: Code that iterates listFunctions() output and then queries each function's metadata (visibility, signature, etc.) as it would for real SqlFunction objects; catalog browsers or UIs listing Hive functions and inspecting details.

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