prestodb/presto · error · UnsupportedOperationException
materialized execution is not supported by the presto on spa
Error message
materialized execution is not supported by the presto on spark
What it means
PrestoSparkPlanFragmenter supplies a PlanNodeIdAllocator whose getNextId always throws UnsupportedOperationException, because materialized (fresh plan-node id allocation for materialized views/CTE re-use) execution is not supported on Spark. Any attempt to allocate new plan node IDs during sub-plan creation aborts.
Source
Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/planner/PrestoSparkPlanFragmenter.java:44
public class PrestoSparkPlanFragmenter
{
private final PlanFragmenter planFragmenter;
@Inject
public PrestoSparkPlanFragmenter(PlanFragmenter planFragmenter)
{
this.planFragmenter = requireNonNull(planFragmenter, "planFragmenter is null");
}
public SubPlan fragmentQueryPlan(Session session, Plan plan, WarningCollector warningCollector)
{
PlanNodeIdAllocator planNodeIdAllocator = new PlanNodeIdAllocator()
{
@Override
public PlanNodeId getNextId()
{
throw new UnsupportedOperationException("materialized execution is not supported by the presto on spark");
}
};
return planFragmenter.createSubPlans(session, plan, false, planNodeIdAllocator, warningCollector);
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Disable materialized execution / CTE materialization session properties when running on Presto on Spark
- Inline the CTE manually instead of relying on automatic materialization
- Upgrade Presto if support for materialized execution on Spark lands in a later release
Example fix
// before SET SESSION cte_materialization_enabled = true; // after SET SESSION cte_materialization_enabled = false; -- unsupported on Presto on Spark
Defensive patterns
Strategy: validation
Validate before calling
if (session.getSystemProperty("cte_materialization_enabled").equals("true")) {
throw new PrestoException(NOT_SUPPORTED, "cte materialization unsupported on Spark");
} Try / catch
try { planFragmenter.createSubPlans(...) } catch (UnsupportedOperationException e) { if (e.getMessage().contains("materialized execution")) { log.error("disable materialization features", e); } throw e; } Prevention
- Set cte_materialization_enabled=false in Spark cluster session defaults
- Rewrite CTE-heavy queries to avoid auto-materialization paths
- Check release notes before enabling new materialization features on Spark
When it happens
Trigger: The fragmenter's createSubPlans path tries to allocate a new plan node id (e.g. materialized execution / CTE materialization features enabled) and hits the stub allocator in getNextId.
Common situations: Enabling CTE materialization or materialized-execution session features on Presto on Spark; queries using features that require re-planning with fresh node IDs.
Related errors
- Coordinator only fragment execution is not supported by nati
- grouped execution is not supported in presto on spark
- SingleMapBlock does not support appendNull()
- SingleRowBlock does not support appendNull()
- KdbTree type cannot be serialized
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/55aa8d8113f8c861.
Report an issue: GitHub.