apache/flink · error · UnsupportedOperationException

The DeltaIteration meta operator cannot have broadcast input

Error message

The DeltaIteration meta operator cannot have broadcast inputs.

What it means

Thrown by DeltaIterationBase.setBroadcastVariable(String, Operator<?>) — always throws UnsupportedOperationException. A DeltaIteration is a meta-operator wrapping an iterative computation with a solution set and workset; broadcast variables cannot be attached at the meta-operator level. They must be attached to operators within the step function body.

Source

Thrown at flink-core/src/main/java/org/apache/flink/api/common/operators/base/DeltaIterationBase.java:251

    /**
     * DeltaIteration meta operator cannot have broadcast inputs.
     *
     * @return An empty map.
     */
    public Map<String, Operator<?>> getBroadcastInputs() {
        return Collections.emptyMap();
    }

    /**
     * The DeltaIteration meta operator cannot have broadcast inputs. This method always throws an
     * exception.
     *
     * @param name Ignored.
     * @param root Ignored.
     */
    public void setBroadcastVariable(String name, Operator<?> root) {
        throw new UnsupportedOperationException(
                "The DeltaIteration meta operator cannot have broadcast inputs.");
    }

    /**
     * The DeltaIteration meta operator cannot have broadcast inputs. This method always throws an
     * exception.
     *
     * @param inputs Ignored
     */
    public <X> void setBroadcastVariables(Map<String, Operator<X>> inputs) {
        throw new UnsupportedOperationException(
                "The DeltaIteration meta operator cannot have broadcast inputs.");
    }

    /**
     * Sets whether to keep the solution set in managed memory (safe against heap exhaustion) or
     * unmanaged memory (objects on heap).
     *

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Do not call setBroadcastVariable on DeltaIterationBase; attach broadcasts to operators within the step function.
  2. Filter DeltaIterationBase and BulkIterationBase from generic broadcast-wiring loops.
  3. Use getBroadcastInputs() (returns empty map) to detect iteration meta-operators.

Example fix

// before
for (Operator<?> op : dag) {
    op.setBroadcastVariable("bc", bcData); // throws for DeltaIterationBase
}

// after
for (Operator<?> op : dag) {
    if (!(op instanceof DeltaIterationBase) && !(op instanceof BulkIterationBase)) {
        op.setBroadcastVariable("bc", bcData);
    }
}
Defensive patterns

Strategy: type-guard

Validate before calling

void safeSetBroadcastVariable(Operator<?> op, String name, Operator<?> bc) {
    if (op instanceof DeltaIterationBase || op instanceof BulkIterationBase) {
        throw new UnsupportedOperationException(
            "Cannot set broadcast variable on iteration meta-operator: " + op);
    }
    op.setBroadcastVariable(name, bc);
}

Type guard

static boolean canHaveBroadcastInputs(Operator<?> op) {
    return !(op instanceof DeltaIterationBase) && !(op instanceof BulkIterationBase);
}

Try / catch

try {
    op.setBroadcastVariable(name, bcData);
} catch (UnsupportedOperationException e) {
    if (e.getMessage().contains("meta operator")) {
        log.debug("Skipping broadcast set on DeltaIteration meta-operator");
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling deltaIteration.setBroadcastVariable("name", someOperator). Generic operator traversal code that calls setBroadcastVariable on every operator in the DAG including iteration meta-operators.

Common situations: Generic visitor/traversal code that uniformly processes all operators. Misunderstanding the meta-operator pattern where broadcast variables belong to inner operators, not the iteration wrapper. Copying broadcast-setup logic across all operators.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/a6dee1ed9ed332dd. Report an issue: GitHub.