prestodb/presto · error · UnsupportedOperationException

Coordinator only fragment execution is not supported by nati

Error message

Coordinator only fragment execution is not supported by native task executor

What it means

The native (Velox C++) task executor for Presto on Spark cannot execute coordinator-only fragments (e.g. final aggregation/limit stages that run only on the coordinator). doCreate checks fragment.getPartitioning().isCoordinatorOnly() and refuses such plans with UnsupportedOperationException. Coordinator-only fragments are normally executed on the Java driver, so routing them to a native worker is unsupported.

Source

Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/execution/task/PrestoSparkNativeTaskExecutorFactory.java:292

        Session session = taskDescriptor.getSession().toSession(
                sessionPropertyManager,
                taskDescriptor.getExtraCredentials(),
                extraAuthenticators.build());
        PlanFragment fragment = taskDescriptor.getFragment();
        StageId stageId = new StageId(session.getQueryId(), fragment.getId().getId());
        TaskId taskId = new TaskId(new StageExecutionId(stageId, 0), partitionId, attemptNumber);

        // TODO: Remove this once we can display the plan on Spark UI.
        // Currently, `textPlanFragment` throws an exception if json-based UDFs are used in the query, which can only
        // happen in native execution mode. To resolve this error, `JsonFileBasedFunctionNamespaceManager` must be
        // loaded on the executors as well (which is actually not required for native execution). To do so, we need a
        // mechanism to ship the JSON file containing the UDF metadata to workers, which does not exist as of today.
        // TODO: Address this issue; more details in https://github.com/prestodb/presto/issues/19600
        log.info("Logging plan fragment is not supported for presto-on-spark native execution, yet");

        if (fragment.getPartitioning().isCoordinatorOnly()) {
            throw new UnsupportedOperationException("Coordinator only fragment execution is not supported by native task executor");
        }

        checkArgument(
                inputs instanceof PrestoSparkNativeTaskInputs,
                format("PrestoSparkNativeTaskInputs is required for native execution, but %s is provided", inputs.getClass().getName()));

        // 1. Start the native process if it hasn't already been started or dead
        createAndStartNativeExecutionProcess(session, nativeTempStorageHandle);

        // 2. compute the task info to send to cpp process
        PrestoSparkNativeTaskInputs nativeInputs = (PrestoSparkNativeTaskInputs) inputs;

        // 2.a Populate Read info
        List<TaskSource> taskSources = getTaskSources(serializedTaskSources, fragment, session, nativeInputs);

        // 2.b Populate Shuffle Write info
        Optional<PrestoSparkShuffleWriteInfo> shuffleWriteInfo = nativeInputs.getShuffleWriteDescriptor()
                .map(descriptor -> shuffleInfoTranslator.createShuffleWriteInfo(session, descriptor));

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Disable native execution for queries/fragments that produce coordinator-only stages (use the Java task executor factory)
  2. Rewrite the query to avoid coordinator-only stages, e.g. use GROUP BY / partitioned aggregation or remove LIMIT patterns that force coordinator-only execution
  3. Check the plan (EXPLAIN) for coordinator-only fragments before enabling native execution
  4. Track https://github.com/prestodb/presto/issues/19600 for coordinator-only fragment support in native execution

Example fix

// before
querySession.setSystemProperty(PRESTO_SPARK_NATIVE_EXECUTION_ENABLED, "true");
// after (fallback for coordinator-only fragments)
if (fragment.getPartitioning().isCoordinatorOnly()) {
    taskExecutorFactory = javaTaskExecutorFactory; // use Java executor
} else {
    taskExecutorFactory = nativeTaskExecutorFactory;
}
Defensive patterns

Strategy: validation

Validate before calling

if (fragment.getPartitioning().isCoordinatorOnly() && nativeExecutionEnabled) {
    throw new PrestoException(NOT_SUPPORTED, "query has coordinator-only fragment; disable native execution");
}

Type guard

boolean isCoordinatorOnly(PlanFragment f) { return f.getPartitioning() != null && f.getPartitioning().isCoordinatorOnly(); }

Try / catch

try { taskExecutorFactory.create(...) } catch (UnsupportedOperationException e) { log.warn("falling back to java executor"); return javaFactory.create(...); }

Prevention

When it happens

Trigger: Running a query whose plan contains a coordinator-only fragment (e.g. a final aggregation stage or LIMIT) with Presto on Spark native execution enabled (native task executor factory PrestoSparkNativeTaskExecutorFactory.doCreate).

Common situations: Operators enabling --native-execution on Spark clusters whose queries finish with coordinator-only final stages; mixing native and coordinator-distributed partitionings; upgrading to native execution while relying on queries with final aggregation stages.

Related errors


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