prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

createContext not supported

What it means

DistributedProcedure.createContext is an optional extension point for connectors supporting distributed procedures; the default implementation deliberately throws NOT_SUPPORTED. Connectors that only implement the non-distributed path (or subclasses that do not override createContext) will throw this when the engine tries to start a distributed procedure execution and create a ConnectorProcedureContext.

Source

Thrown at presto-spi/src/main/java/com/facebook/presto/spi/procedure/DistributedProcedure.java:65

    /**
     * Performs the preparatory work required when starting the execution of this distributed procedure.
     * */
    public abstract ConnectorDistributedProcedureHandle begin(ConnectorSession session, ConnectorProcedureContext procedureContext, ConnectorTableLayoutHandle tableLayoutHandle, Object[] arguments);

    /**
     * Performs the work required for the final centralized commit, after all distributed execution tasks have completed.
     * */
    public abstract void finish(ConnectorSession session, ConnectorProcedureContext procedureContext, ConnectorDistributedProcedureHandle procedureHandle, Collection<Slice> fragments);

    /**
     * Creates a connector-specific, or even a distributed procedure subtype-specific context object.
     * For connectors that support distributed procedures, this method is invoked at the start of a distributed procedure's execution.
     * The generated procedure context is then bound to the current ConnectorMetadata, maintaining all contextual information
     * throughout the execution. This context would be accessed during calls to the procedure's {@link #begin} and {@link #finish} methods.
     */
    public ConnectorProcedureContext createContext(Object... arguments)
    {
        throw new PrestoException(StandardErrorCode.NOT_SUPPORTED, "createContext not supported");
    }

    public enum DistributedProcedureType
    {
        TABLE_DATA_REWRITE
    }

    public static class Argument
            extends BaseProcedure.BaseArgument
    {
        public Argument(String name, String type)
        {
            super(name, type);
        }

        public Argument(String name, String type, boolean required, @Nullable Object defaultValue)
        {
            super(name, type, required, defaultValue);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Do not call the distributed procedure against this connector; use the connector's supported (local) procedure instead
  2. If you are the connector author, override createContext() to return a ConnectorProcedureContext
  3. Verify the connector version supports distributed procedures before invoking them
  4. Check the connector's procedure registry to see which DistributedProcedureType it advertises

Example fix

// before
@Override
public ConnectorProcedureContext createContext(Object... arguments) {
    return super.createContext(arguments); // throws NOT_SUPPORTED
}
// after
@Override
public ConnectorProcedureContext createContext(Object... arguments) {
    return new MyConnectorProcedureContext(session, arguments);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Check connector capabilities before invoking distributed procedures
if (!connectorSupportsDistributedProcedures(connectorName)) {
    throw new UnsupportedOperationException(connectorName + " does not support distributed procedures");
}

Type guard

boolean supportsCreateContext(DistributedProcedure proc) {
    try {
        proc.getClass().getDeclaredMethod("createContext", Object[].class);
        return true;
    } catch (NoSuchMethodException e) {
        return false;
    }
}

Try / catch

try {
    procedureExecutionContext = distributedProcedure.createContext(args);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == StandardErrorCode.NOT_SUPPORTED.toErrorCode().getCode()) {
        // fall back to the non-distributed procedure path
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Executing a distributed procedure (e.g. table data rewrite) against a connector whose DistributedProcedure subclass does not override createContext().

Common situations: Connector declares/supports distributed procedures but the subclass wasn't updated to implement createContext; invoking a rewrite/compaction procedure on a connector that only supports local procedures; upgrading the engine to a version that requires distributed-procedure support the connector lacks.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


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