prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
Unsupported explain plan type %s for JSON format
What it means
QueryExplainer.getJsonPlan can only render LOGICAL or DISTRIBUTED plans in JSON explain format. If the session's explain plan type is anything else (e.g. IO, VALIDATE, or an unknown type), it falls through the switch's default branch and throws NOT_SUPPORTED, because there is no JSON rendering for that plan type.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/QueryExplainer.java:199
DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass());
if (task != null) {
// todo format as json
return explainTask(statement, task, parameters);
}
Plan plan;
switch (planType) {
case IO:
plan = getLogicalPlan(session, statement, parameters, warningCollector, query, viewDefinitionReferences);
return textIOPlan(plan.getRoot(), metadata, session);
case LOGICAL:
plan = getLogicalPlan(session, statement, parameters, warningCollector, query, viewDefinitionReferences);
return jsonLogicalPlan(plan.getRoot(), plan.getTypes(), metadata.getFunctionAndTypeManager(), plan.getStatsAndCosts(), session);
case DISTRIBUTED:
SubPlan subPlan = getDistributedPlan(session, statement, parameters, warningCollector, query, viewDefinitionReferences);
return jsonDistributedPlan(subPlan, metadata.getFunctionAndTypeManager(), session);
default:
throw new PrestoException(NOT_SUPPORTED, format("Unsupported explain plan type %s for JSON format", planType));
}
}
public Plan getLogicalPlan(Session session, Statement statement, List<Expression> parameters, WarningCollector warningCollector, String query, ViewDefinitionReferences viewDefinitionReferences)
{
return getLogicalPlan(session, statement, parameters, warningCollector, new PlanNodeIdAllocator(), query, viewDefinitionReferences);
}
public Plan getLogicalPlan(Session session, Statement statement, List<Expression> parameters, WarningCollector warningCollector, PlanNodeIdAllocator idAllocator, String query, ViewDefinitionReferences viewDefinitionReferences)
{
// analyze statement
Analysis analysis = session.getRuntimeStats()
.recordWallAndCpuTime(ANALYZE_TIME_NANOS, () -> analyze(session, statement, parameters, warningCollector, query, viewDefinitionReferences));
final VariableAllocator planVariableAllocator = new VariableAllocator();
LogicalPlanner logicalPlanner = new LogicalPlanner(
session,
idAllocator,View on GitHub (pinned to 55bb57d202)
Solutions
- Use TYPE LOGICAL or TYPE DISTRIBUTED with EXPLAIN (FORMAT JSON)
- Drop the TYPE clause so the default (distributed) plan type is used
- Render unsupported plan types with the default text format instead of JSON
Example fix
// before EXPLAIN (TYPE VALIDATE, FORMAT JSON) SELECT 1; // after EXPLAIN (TYPE DISTRIBUTED, FORMAT JSON) SELECT 1;
Defensive patterns
Strategy: validation
Validate before calling
EnumSet<ExplainType.Type> jsonSupported = EnumSet.of(ExplainType.Type.LOGICAL, ExplainType.Type.DISTRIBUTED);
if (!jsonSupported.contains(explainType)) {
throw new IllegalArgumentException("FORMAT JSON only supports TYPE LOGICAL or TYPE DISTRIBUTED");
} Type guard
boolean supportsJsonPlan(ExplainType.Type type) { return type == ExplainType.Type.LOGICAL || type == ExplainType.Type.DISTRIBUTED; } Try / catch
try { return explainer.getJsonExplainPlan(...); } catch (PrestoException e) { if (e.getErrorCode().getCode() == NOT_SUPPORTED.toErrorCode().getCode()) { /* fall back to text format */ } else { throw e; } } Prevention
- Only pair FORMAT JSON with TYPE LOGICAL or TYPE DISTRIBUTED
- Validate EXPLAIN options client-side before submission
- Read the EXPLAIN docs matrix of supported TYPE/FORMAT combos
When it happens
Trigger: Running 'EXPLAIN (FORMAT JSON, TYPE <unsupported>) ...' where the explain TYPE is not LOGICAL or DISTRIBUTED, e.g. TYPE VALIDATE or TYPE IO with FORMAT JSON.
Common situations: Combining EXPLAIN FORMAT JSON with plan types that only have text renderings; copying an EXPLAIN invocation and changing FORMAT without adjusting TYPE.
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/50884d025a2001e7.
Report an issue: GitHub.