pnowojski commented on code in PR #20158:
URL: https://github.com/apache/flink/pull/20158#discussion_r914665324


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamNode.java:
##########
@@ -265,17 +266,19 @@ public void setOperatorDescription(String 
operatorDescription) {
 
     public void setSerializersIn(TypeSerializer<?>... typeSerializersIn) {
         checkArgument(typeSerializersIn.length > 0);
-        this.typeSerializersIn = typeSerializersIn;
+        // Unfortunately code above assumes type serializer can be null, while 
users of for example
+        // getTypeSerializersIn would be confused by returning an array size 
of two with all
+        // elements set to null...
+        this.typeSerializersIn =
+                Arrays.stream(typeSerializersIn)
+                        .filter(typeSerializer -> typeSerializer != null)
+                        .toArray(TypeSerializer<?>[]::new);
     }
 
     public TypeSerializer<?>[] getTypeSerializersIn() {

Review Comment:
   It must be kept in sync with `StreamNode#getInEdges`. Each edge has it's own 
input serializer. It can never happen that first element is null, second is not 
null. Sources have zero inputs, one input task has single input, two input 
tasks have two inputs, multi input tasks have N inputs. 



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

Reply via email to