rkhachatryan commented on a change in pull request #10151: [FLINK-14231] Handle
the processing-time timers when closing operators to make endInput semantics on
the operator chain strict
URL: https://github.com/apache/flink/pull/10151#discussion_r355532122
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
##########
@@ -186,15 +191,34 @@ public OperatorChain(
@VisibleForTesting
OperatorChain(
- StreamOperator<?>[] allOperators,
+ List<StreamOperatorWrapper<?, ?>> allOperatorWrappers,
RecordWriterOutput<?>[] streamOutputs,
WatermarkGaugeExposingOutput<StreamRecord<OUT>>
chainEntryPoint,
- OP headOperator) {
+ StreamOperatorWrapper<OUT, OP> headOperatorWrapper) {
- this.allOperators = checkNotNull(allOperators);
this.streamOutputs = checkNotNull(streamOutputs);
this.chainEntryPoint = checkNotNull(chainEntryPoint);
- this.headOperator = checkNotNull(headOperator);
+
+ checkState(allOperatorWrappers != null &&
allOperatorWrappers.size() > 0);
+ this.headOperatorWrapper = headOperatorWrapper;
+ this.tailOperatorWrapper = allOperatorWrappers.get(0);
+
+ this.allOperatorWrappers = new HashMap<>();
+ initOperatorWrappers(allOperatorWrappers);
+ }
+
+ private void initOperatorWrappers(List<StreamOperatorWrapper<?, ?>>
allOperatorWrappers) {
+ int size = allOperatorWrappers.size();
+ for (int i = 0; i < size; i++) {
+ StreamOperatorWrapper operatorWrapper =
allOperatorWrappers.get(i);
+ operatorWrapper.setPrevious(i < (size - 1) ?
allOperatorWrappers.get(i + 1) : null);
+ operatorWrapper.setNext(i > 0 ?
allOperatorWrappers.get(i - 1) : null);
Review comment:
Can we iterate without random access (keeping prev and curr pointers) or
ensure that random access is efficient (by requiring ArrayList instead of List)?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services