{"record":{"id":"ec6df979b1eefe4b","repo":"prestodb/presto","slug":"explain-analyze-is-not-supported","errorCode":null,"errorMessage":"explain analyze is not supported","messagePattern":"explain analyze is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-spark-base/src/main/java/com/facebook/presto/spark/PrestoSparkModule.java","lineNumber":539,"sourceCode":"        configBinder(binder).bindConfig(QueryMonitorConfig.class);\n        binder.bind(SplitMonitor.class).in(Scopes.SINGLETON);\n\n        // Determine the NodeVersion\n        ServerConfig serverConfig = buildConfigObject(ServerConfig.class);\n        NodeVersion nodeVersion = new NodeVersion(serverConfig.getPrestoVersion());\n        binder.bind(NodeVersion.class).toInstance(nodeVersion);\n\n        //Support DDL statements. Helper class binds DDL statements to DataDefinitionTasks\n        PrestoDataDefBindingHelper.bindDDLDefinitionTasks(binder);\n\n        // TODO: Decouple node specific system tables\n        binder.bind(QueryManager.class).to(PrestoSparkQueryManager.class).in(Scopes.SINGLETON);\n        binder.bind(TaskManager.class).to(PrestoSparkTaskManager.class).in(Scopes.SINGLETON);\n        binder.install(new SystemConnectorModule());\n\n        // TODO: support explain analyze for Spark\n        binder.bind(new TypeLiteral<Optional<ExplainAnalyzeContext>>() {}).toInstance(Optional.of(new ExplainAnalyzeContext((queryId) -> {\n            throw new UnsupportedOperationException(\"explain analyze is not supported\");\n        })));\n\n        // TODO: support CBO, supply real nodes count\n        binder.bind(TaskCountEstimator.class).toInstance(new TaskCountEstimator(() -> 1000));\n\n        // TODO: Decouple and remove: required by ConnectorManager\n        binder.bind(InternalNodeManager.class).toInstance(new PrestoSparkInternalNodeManager());\n        binder.bind(PluginNodeManager.class).in(Scopes.SINGLETON);\n\n        // TODO: Decouple and remove: required by PluginManager\n        binder.bind(InternalResourceGroupManager.class).in(Scopes.SINGLETON);\n        binder.bind(ResourceGroupManager.class).to(InternalResourceGroupManager.class);\n        binder.bind(new TypeLiteral<ResourceGroupManager<?>>() {}).to(new TypeLiteral<InternalResourceGroupManager<?>>() {});\n        binder.bind(ClusterMemoryPoolManager.class).toInstance(((poolId, listener) -> {}));\n        binder.bind(QueryPrerequisitesManager.class).in(Scopes.SINGLETON);\n        binder.bind(ResourceGroupService.class).to(NoopResourceGroupService.class).in(Scopes.SINGLETON);\n        binder.bind(NodeTtlFetcherManager.class).to(ThrowingNodeTtlFetcherManager.class).in(Scopes.SINGLETON);\n        binder.bind(ClusterTtlProviderManager.class).to(ThrowingClusterTtlProviderManager.class).in(Scopes.SINGLETON);","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spark-base/src/main/java/com/facebook/presto/spark/PrestoSparkModule.java#L521-L557","documentation":"Presto on Spark does not support EXPLAIN ANALYZE. In PrestoSparkModule.setup, the bound ExplainAnalyzeContext's query-id callback immediately throws UnsupportedOperationException('explain analyze is not supported'), because there is no per-task completion tracking on Spark yet (noted by the TODO). The query is planned but execution of EXPLAIN ANALYZE aborts.","triggerScenarios":"Running 'EXPLAIN ANALYZE <query>' against a Presto on Spark cluster (any statement submitted through PrestoSparkLauncher).","commonSituations":"Using the same BI tools/scripts against both a normal Presto cluster and Presto on Spark; validating query performance on Spark with EXPLAIN ANALYZE out of habit.","solutions":["Use plain EXPLAIN on Spark to inspect the plan without runtime statistics","Run the query and inspect Presto Spark query/execution statistics from the Spark UI and query completion events instead","Upgrade to a Presto Spark version that implements EXPLAIN ANALYZE support if/when available"],"exampleFix":"-- before\nEXPLAIN ANALYZE SELECT count(*) FROM nation;\n-- after\nEXPLAIN SELECT count(*) FROM nation;","handlingStrategy":"fallback","validationCode":"if (sql.trim().toUpperCase(Locale.ROOT).startsWith(\"EXPLAIN ANALYZE\")) {\n    throw new IllegalArgumentException(\"EXPLAIN ANALYZE is not supported on Presto on Spark; use EXPLAIN\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.execute(sql);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"explain analyze is not supported\")) {\n        sql = sql.replaceFirst(\"(?i)EXPLAIN\\\\s+ANALYZE\", \"EXPLAIN\");\n        client.execute(sql);\n    } else throw e;\n}","preventionTips":["Strip or downgrade EXPLAIN ANALYZE to EXPLAIN in tooling that targets Spark clusters","Detect the cluster type and disable EXPLAIN ANALYZE features in BI tools","Rely on Spark UI/query completion events for runtime statistics instead"],"tags":["presto-spark","explain","unsupported-feature"],"backgroundTag":"feature-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"}