sunhaibotb commented on a change in pull request #10151: [FLINK-14231] Handle 
the pending processing-time timers to make endInput semantics on the operator 
chain strict
URL: https://github.com/apache/flink/pull/10151#discussion_r367200322
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/OperatorChain.java
 ##########
 @@ -140,34 +140,41 @@ public OperatorChain(
                        }
 
                        // we create the chain of operators and grab the 
collector that leads into the chain
-                       List<StreamOperator<?>> allOps = new 
ArrayList<>(chainedConfigs.size());
+                       List<StreamOperatorWrapper<?, ?>> allOpWrappers = new 
ArrayList<>(chainedConfigs.size());
                        this.chainEntryPoint = createOutputCollector(
                                containingTask,
                                configuration,
                                chainedConfigs,
                                userCodeClassloader,
                                streamOutputMap,
-                               allOps,
+                               allOpWrappers,
                                containingTask.getMailboxExecutorFactory());
 
                        if (operatorFactory != null) {
                                WatermarkGaugeExposingOutput<StreamRecord<OUT>> 
output = getChainEntryPoint();
 
-                               headOperator = 
StreamOperatorFactoryUtil.createOperator(
+                               OP headOperator = 
StreamOperatorFactoryUtil.createOperator(
                                                operatorFactory,
                                                containingTask,
                                                configuration,
                                                output);
 
                                
headOperator.getMetricGroup().gauge(MetricNames.IO_CURRENT_OUTPUT_WATERMARK, 
output.getWatermarkGauge());
+                               this.headOperatorWrapper = 
createOperatorWrapper(headOperator, containingTask, configuration);
+
+                               // add head operator to end of chain
+                               allOpWrappers.add(headOperatorWrapper);
+
+                               this.tailOperatorWrapper = allOpWrappers.get(0);
                        } else {
-                               headOperator = null;
+                               checkState(allOpWrappers.size() == 0);
 
 Review comment:
   Currently, only in the case of iteration, `StreamIterationHead` and 
`StreamIterationTail` do not contain any operators. In the future, I think we 
don't want to introduce the case that the operator chain contains operators but 
the header operator is `null`. @rkhachatryan 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to