{"record":{"id":"a6dee1ed9ed332dd","repo":"apache/flink","slug":"the-deltaiteration-meta-operator-cannot-have-broad","errorCode":null,"errorMessage":"The DeltaIteration meta operator cannot have broadcast inputs.","messagePattern":"The DeltaIteration meta operator cannot have broadcast inputs\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/operators/base/DeltaIterationBase.java","lineNumber":251,"sourceCode":"\n    /**\n     * DeltaIteration meta operator cannot have broadcast inputs.\n     *\n     * @return An empty map.\n     */\n    public Map<String, Operator<?>> getBroadcastInputs() {\n        return Collections.emptyMap();\n    }\n\n    /**\n     * The DeltaIteration meta operator cannot have broadcast inputs. This method always throws an\n     * exception.\n     *\n     * @param name Ignored.\n     * @param root Ignored.\n     */\n    public void setBroadcastVariable(String name, Operator<?> root) {\n        throw new UnsupportedOperationException(\n                \"The DeltaIteration meta operator cannot have broadcast inputs.\");\n    }\n\n    /**\n     * The DeltaIteration meta operator cannot have broadcast inputs. This method always throws an\n     * exception.\n     *\n     * @param inputs Ignored\n     */\n    public <X> void setBroadcastVariables(Map<String, Operator<X>> inputs) {\n        throw new UnsupportedOperationException(\n                \"The DeltaIteration meta operator cannot have broadcast inputs.\");\n    }\n\n    /**\n     * Sets whether to keep the solution set in managed memory (safe against heap exhaustion) or\n     * unmanaged memory (objects on heap).\n     *","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/operators/base/DeltaIterationBase.java#L233-L269","documentation":"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.","triggerScenarios":"Calling deltaIteration.setBroadcastVariable(\"name\", someOperator). Generic operator traversal code that calls setBroadcastVariable on every operator in the DAG including iteration meta-operators.","commonSituations":"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.","solutions":["Do not call setBroadcastVariable on DeltaIterationBase; attach broadcasts to operators within the step function.","Filter DeltaIterationBase and BulkIterationBase from generic broadcast-wiring loops.","Use getBroadcastInputs() (returns empty map) to detect iteration meta-operators."],"exampleFix":"// before\nfor (Operator<?> op : dag) {\n    op.setBroadcastVariable(\"bc\", bcData); // throws for DeltaIterationBase\n}\n\n// after\nfor (Operator<?> op : dag) {\n    if (!(op instanceof DeltaIterationBase) && !(op instanceof BulkIterationBase)) {\n        op.setBroadcastVariable(\"bc\", bcData);\n    }\n}","handlingStrategy":"type-guard","validationCode":"void safeSetBroadcastVariable(Operator<?> op, String name, Operator<?> bc) {\n    if (op instanceof DeltaIterationBase || op instanceof BulkIterationBase) {\n        throw new UnsupportedOperationException(\n            \"Cannot set broadcast variable on iteration meta-operator: \" + op);\n    }\n    op.setBroadcastVariable(name, bc);\n}","typeGuard":"static boolean canHaveBroadcastInputs(Operator<?> op) {\n    return !(op instanceof DeltaIterationBase) && !(op instanceof BulkIterationBase);\n}","tryCatchPattern":"try {\n    op.setBroadcastVariable(name, bcData);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"meta operator\")) {\n        log.debug(\"Skipping broadcast set on DeltaIteration meta-operator\");\n    } else {\n        throw e;\n    }\n}","preventionTips":["Check instanceof DeltaIterationBase before calling setBroadcastVariable.","Attach broadcasts to step function inner operators, not the iteration wrapper.","Handle iteration meta-operators specially in generic DAG processing code."],"tags":["delta-iteration","broadcast-variable","unsupported-operation","dataset-api","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}