1u0 commented on a change in pull request #8742: [FLINK-11879] Add validators 
for the uses of InputSelectable, BoundedOneInput and BoundedMultiInput
URL: https://github.com/apache/flink/pull/8742#discussion_r301487379
 
 

 ##########
 File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java
 ##########
 @@ -661,18 +664,31 @@ private void configureCheckpointing() {
                                "exactly-once or at-least-once.");
                }
 
-               //  --- configure the master-side checkpoint hooks ---
+               //  --- configure the master-side checkpoint hooks and check 
the types of operators---
 
                final ArrayList<MasterTriggerRestoreHook.Factory> hooks = new 
ArrayList<>();
 
                for (StreamNode node : streamGraph.getStreamNodes()) {
-                       if (node.getOperatorFactory() instanceof 
UdfStreamOperatorFactory) {
-                               Function f = ((UdfStreamOperatorFactory) 
node.getOperatorFactory()).getUserFunction();
+                       StreamOperatorFactory operatorFactory = 
node.getOperatorFactory();
+                       if (operatorFactory instanceof 
UdfStreamOperatorFactory) {
+                               Function f = ((UdfStreamOperatorFactory) 
operatorFactory).getUserFunction();
 
                                if (f instanceof WithMasterCheckpointHook) {
                                        hooks.add(new 
FunctionMasterCheckpointHookFactory((WithMasterCheckpointHook<?>) f));
                                }
                        }
+
+                       if (cfg.isCheckpointingEnabled() && operatorFactory != 
null) {
 
 Review comment:
   I don't mean to change this logic.
   Currently you are overloading `configureCheckpointing()` with logic that can 
be done independently (validation) here.
   This code would be better if it's extracted into a separate method and 
better if called before all other things in 
`StreamingJobGraphGenerator.createJobGraph()` are run ("fail early").
   
   As mentioned before, `StreamGraph.getJobGraph()` already has some validation 
check - you can unify them together with the new check.
   
   The only missing validation case is `InputSelectable` and network 
credit-based flow control. But it seems fine to keep it as it's now.

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

Reply via email to