mynameborat commented on code in PR #25068:
URL: https://github.com/apache/beam/pull/25068#discussion_r1083138052
##########
runners/samza/src/main/java/org/apache/beam/runners/samza/runtime/SamzaDoFnRunners.java:
##########
@@ -316,12 +322,25 @@ public FnDataReceiver<FnOutT> create(String
pCollectionId) {
final TimerReceiverFactory timerReceiverFactory =
new TimerReceiverFactory(stageBundleFactory,
this::timerDataConsumer, windowCoder);
+ Map<String, String> transformFullNameToUniqueName =
+ pTransformNodes.stream()
+ .collect(
+ Collectors.toMap(
+ pTransformNode -> pTransformNode.getId(),
+ pTransformNode ->
pTransformNode.getTransform().getUniqueName()));
Review Comment:
the class holds a reference of `Collection<pTransformNode>` and this
reference can change over the lifecycle of this class and the transform name
map that you produce changes everytime when something changes to this reference
and thus causing the invariant of passing potentially different metric names
upon the callsite.
By enforcing the computation to occur only once at least guarantees we
always pass the same transform name maps and hence easy to reason about what
the code does and how it behaves.
--
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]