You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/04/27 17:50:55 UTC

[GitHub] [beam] lukecwik commented on a change in pull request #11154: [BEAM-1819] Key should be available in @OnTimer methods

lukecwik commented on a change in pull request #11154:
URL: https://github.com/apache/beam/pull/11154#discussion_r416023080



##########
File path: sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java
##########
@@ -560,7 +560,6 @@ public Instant timestamp(DoFn<InputT, OutputT> doFn) {
         throw new IllegalStateException(
             String.format("Unknown URN %s", pTransform.getSpec().getUrn()));
     }
-    this.onTimerContext = new OnTimerContext();

Review comment:
       The intent of these context objects was to not create a new one when processing each element/timer and instead to reference a member variable as can be seen in:
   https://github.com/apache/beam/blob/591de3473144de54beef0932131025e2a4d8504b/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java#L1468
   https://github.com/apache/beam/blob/591de3473144de54beef0932131025e2a4d8504b/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnApiDoFnRunner.java#L1506
   
   It would have made more sense to have OnTimerContext just return `currentTimer.getUserKey()`




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org