You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "zhipeng93 (via GitHub)" <gi...@apache.org> on 2023/04/10 06:28:21 UTC

[GitHub] [flink-ml] zhipeng93 commented on a diff in pull request #229: [FLINK-31255] Wraps the operator config about serializer

zhipeng93 commented on code in PR #229:
URL: https://github.com/apache/flink-ml/pull/229#discussion_r1161461542


##########
flink-ml-iteration/src/main/java/org/apache/flink/iteration/operator/OperatorUtils.java:
##########
@@ -104,6 +107,33 @@ public static StreamConfig createWrappedOperatorConfig(
             }
         }
 
+        StreamConfig.InputConfig[] inputs = wrapperConfig.getInputs(cl);
+        for (int i = 0; i < inputs.length; ++i) {
+            if (inputs[i] instanceof NetworkInputConfig) {
+                TypeSerializer<?> typeSerializerIn =
+                        ((NetworkInputConfig) inputs[i]).getTypeSerializer();
+                if (typeSerializerIn instanceof IterationRecordSerializer) {

Review Comment:
   It seems that `typeSerializerIn` and `typeSerializerOut` should always be `IterationRecordSerializer` for wrapped iteration operators if they are not null.
   
   Is there any case that this condition does not hold?



##########
flink-ml-iteration/src/main/java/org/apache/flink/iteration/operator/OperatorUtils.java:
##########
@@ -104,6 +107,33 @@ public static StreamConfig createWrappedOperatorConfig(
             }
         }
 
+        StreamConfig.InputConfig[] inputs = wrapperConfig.getInputs(cl);
+        for (int i = 0; i < inputs.length; ++i) {
+            if (inputs[i] instanceof NetworkInputConfig) {
+                TypeSerializer<?> typeSerializerIn =
+                        ((NetworkInputConfig) inputs[i]).getTypeSerializer();
+                if (typeSerializerIn instanceof IterationRecordSerializer) {
+                    wrappedConfig.setInputs(
+                            new NetworkInputConfig(
+                                    ((IterationRecordSerializer<?>) typeSerializerIn)
+                                            .getInnerSerializer(),
+                                    i));
+                }
+            }
+        }
+
+        TypeSerializer<?> typeSerializerOut = wrapperConfig.getTypeSerializerOut(cl);
+        if (typeSerializerOut instanceof IterationRecordSerializer) {
+            wrappedConfig.setTypeSerializerOut(
+                    ((IterationRecordSerializer<?>) typeSerializerOut).getInnerSerializer());
+        }
+
+        TypeSerializer<?> stateKeySerializer = wrapperConfig.getStateKeySerializer(cl);
+        if (stateKeySerializer instanceof IterationRecordSerializer) {
+            wrappedConfig.setTypeSerializerOut(

Review Comment:
   It should be `wrappedConfig.setStateKeySerializer(...)` here.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org