Abacn commented on code in PR #41426:
URL: https://github.com/apache/beam/pull/41426#discussion_r4672327771


##########
runners/spark/4/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/streaming/StatefulParDoStreamingTranslator.java:
##########
@@ -60,29 +70,66 @@ protected void translate(ParDo.MultiOutput<KV<K, V>, 
OutputT> transform, Context
     KvCoder<K, V> inputCoder = (KvCoder<K, V>) input.getCoder();
     Coder<K> keyCoder = inputCoder.getKeyCoder();
     TupleTag<OutputT> mainOutputTag = transform.getMainOutputTag();
-    PCollection<OutputT> output = cxt.getOutput(mainOutputTag);
-    Coder<OutputT> outputCoder = output.getCoder();
+    Map<TupleTag<?>, PCollection<?>> outputs =

Review Comment:
   (from gemini) Unconsumed mainTag with a consumed additionalTag spawns a 
redundant streaming query:
   
   - ParDoTranslatorBatch.skipUnconsumedOutputs always retains mainTag even 
when cxt.isLeaf(mainOutput) is true.
   - If a pipeline consumes only an additionalTag and ignores mainTag, outputs 
has size 2 ({mainTag, additionalTag}), so cxt.putDataset(mainOutput, ...) 
registers the unconsumed mainTag in leaves. In Spark 4 streaming, 
StreamingEvaluationContext
    then starts an entire extra StreamingQuery (with its own duplicate 
transformWithState state store & checkpoint) solely to discard mainTag into 
noop.
   - This matches existing stateless ParDoTranslatorBatch behavior, so it's 
acceptable if intentional, but much heavier for stateful transformWithState — 
worth confirming or tracking alongside #41425 / #41198.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to