{"record":{"id":"e276e56758ce89be","repo":"prestodb/presto","slug":"not-supported-e276e5","errorCode":"NOT_SUPPORTED","errorMessage":"createContext not supported","messagePattern":"createContext not supported","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-spi/src/main/java/com/facebook/presto/spi/procedure/DistributedProcedure.java","lineNumber":65,"sourceCode":"    /**\n     * Performs the preparatory work required when starting the execution of this distributed procedure.\n     * */\n    public abstract ConnectorDistributedProcedureHandle begin(ConnectorSession session, ConnectorProcedureContext procedureContext, ConnectorTableLayoutHandle tableLayoutHandle, Object[] arguments);\n\n    /**\n     * Performs the work required for the final centralized commit, after all distributed execution tasks have completed.\n     * */\n    public abstract void finish(ConnectorSession session, ConnectorProcedureContext procedureContext, ConnectorDistributedProcedureHandle procedureHandle, Collection<Slice> fragments);\n\n    /**\n     * Creates a connector-specific, or even a distributed procedure subtype-specific context object.\n     * For connectors that support distributed procedures, this method is invoked at the start of a distributed procedure's execution.\n     * The generated procedure context is then bound to the current ConnectorMetadata, maintaining all contextual information\n     * throughout the execution. This context would be accessed during calls to the procedure's {@link #begin} and {@link #finish} methods.\n     */\n    public ConnectorProcedureContext createContext(Object... arguments)\n    {\n        throw new PrestoException(StandardErrorCode.NOT_SUPPORTED, \"createContext not supported\");\n    }\n\n    public enum DistributedProcedureType\n    {\n        TABLE_DATA_REWRITE\n    }\n\n    public static class Argument\n            extends BaseProcedure.BaseArgument\n    {\n        public Argument(String name, String type)\n        {\n            super(name, type);\n        }\n\n        public Argument(String name, String type, boolean required, @Nullable Object defaultValue)\n        {\n            super(name, type, required, defaultValue);","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spi/src/main/java/com/facebook/presto/spi/procedure/DistributedProcedure.java#L47-L83","documentation":"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.","triggerScenarios":"Executing a distributed procedure (e.g. table data rewrite) against a connector whose DistributedProcedure subclass does not override createContext().","commonSituations":"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.","solutions":["Do not call the distributed procedure against this connector; use the connector's supported (local) procedure instead","If you are the connector author, override createContext() to return a ConnectorProcedureContext","Verify the connector version supports distributed procedures before invoking them","Check the connector's procedure registry to see which DistributedProcedureType it advertises"],"exampleFix":"// before\n@Override\npublic ConnectorProcedureContext createContext(Object... arguments) {\n    return super.createContext(arguments); // throws NOT_SUPPORTED\n}\n// after\n@Override\npublic ConnectorProcedureContext createContext(Object... arguments) {\n    return new MyConnectorProcedureContext(session, arguments);\n}","handlingStrategy":"try-catch","validationCode":"// Check connector capabilities before invoking distributed procedures\nif (!connectorSupportsDistributedProcedures(connectorName)) {\n    throw new UnsupportedOperationException(connectorName + \" does not support distributed procedures\");\n}","typeGuard":"boolean supportsCreateContext(DistributedProcedure proc) {\n    try {\n        proc.getClass().getDeclaredMethod(\"createContext\", Object[].class);\n        return true;\n    } catch (NoSuchMethodException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    procedureExecutionContext = distributedProcedure.createContext(args);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == StandardErrorCode.NOT_SUPPORTED.toErrorCode().getCode()) {\n        // fall back to the non-distributed procedure path\n    } else {\n        throw e;\n    }\n}","preventionTips":["Confirm distributed-procedure support in the connector before calling rewrite procedures","Override createContext in custom DistributedProcedure subclasses","Pin connector versions that advertise the DistributedProcedureType you need"],"tags":["procedure","not-supported","connector"],"backgroundTag":"operation-not-supported","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}