junaiddshaukat commented on code in PR #38987:
URL: https://github.com/apache/beam/pull/38987#discussion_r3433628823


##########
runners/kafka-streams/src/main/java/org/apache/beam/runners/kafka/streams/translation/ExecutableStageProcessor.java:
##########
@@ -87,22 +98,43 @@ class ExecutableStageProcessor
   @Override
   public void init(ProcessorContext<byte[], KStreamsPayload<?>> context) {
     this.context = context;
-    ExecutableStage executableStage = 
ExecutableStage.fromPayload(stagePayload);
-    this.stageContext = 
KafkaStreamsExecutableStageContextFactory.getInstance().get(jobInfo);
-    this.stageBundleFactory = 
stageContext.getStageBundleFactory(executableStage);
+    // The SDK harness (stage context + bundle factory) is created lazily on 
the first data
+    // element, so a stage that only forwards watermarks never spins one up. 
This mirrors Spark's
+    // SparkExecutableStageFunction, which likewise does not build a bundle 
factory when there are
+    // no inputs to process.
+  }
+
+  private StageBundleFactory ensureStageBundleFactory() {
+    StageBundleFactory factory = stageBundleFactory;
+    if (factory == null) {
+      ExecutableStage executableStage = 
ExecutableStage.fromPayload(stagePayload);
+      ExecutableStageContext sc =

Review Comment:
   Done  ensureStageBundleFactory is void now and assigns the fields directly; 
ensureBundleOpen reads the field via checkInitialized().



-- 
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