kennknowles commented on code in PR #41719:
URL: https://github.com/apache/beam/pull/41719#discussion_r4788730873
##########
runners/core-java/src/main/java/org/apache/beam/runners/core/triggers/TriggerStateMachineRunner.java:
##########
@@ -236,9 +238,49 @@ public void clearState(W window, Timers timers,
StateAccessor<?> state) throws E
rootTrigger.invokeClear(contextFactory.base(window, timers, rootTrigger,
finishedSet));
}
- private boolean isFinishedSetNeeded() {
- // TODO: If we know that no trigger in the tree will ever finish, we don't
need to do the
- // lookup. Right now, we special case this for the DefaultTrigger.
- return !(rootTrigger.getSpec() instanceof DefaultTriggerStateMachine);
+ private static boolean canElideFinishedSet(ExecutableTriggerStateMachine
trigger) {
Review Comment:
This seems like it should be a method of `TriggerStateMachine` so each
implementation can say whether it needs it.
##########
runners/core-java/src/main/java/org/apache/beam/runners/core/triggers/TriggerStateMachineRunner.java:
##########
@@ -236,9 +238,49 @@ public void clearState(W window, Timers timers,
StateAccessor<?> state) throws E
rootTrigger.invokeClear(contextFactory.base(window, timers, rootTrigger,
finishedSet));
}
- private boolean isFinishedSetNeeded() {
- // TODO: If we know that no trigger in the tree will ever finish, we don't
need to do the
- // lookup. Right now, we special case this for the DefaultTrigger.
- return !(rootTrigger.getSpec() instanceof DefaultTriggerStateMachine);
+ private static boolean canElideFinishedSet(ExecutableTriggerStateMachine
trigger) {
+ TriggerStateMachine spec = trigger.getSpec();
+ if (neverTracksFinishedBits(spec)) {
+ return true;
+ }
+ if (spec instanceof RepeatedlyStateMachine) {
+ return canElideRepeatedSubtree(trigger.subTriggers().get(0));
Review Comment:
Here, too.
--
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]