AHeise commented on a change in pull request #13735:
URL: https://github.com/apache/flink/pull/13735#discussion_r518152519



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/ChannelRescalerRepartitioner.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.checkpoint;
+
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.runtime.io.network.api.writer.ChannelStateRescaler;
+
+import org.apache.flink.shaded.guava18.com.google.common.collect.Iterables;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * A repartitioner that assigns the same channel state to multiple subtasks 
according to some mapping.
+ *
+ * <p>The replicated data will then be filtered before processing the record.
+ *
+ * <p>Note that channel mappings are cached for the same parallelism changes.
+ */
+public class ChannelRescalerRepartitioner<T> implements 
OperatorStateRepartitioner<T> {
+       private final ChannelStateRescaler channelStateRescaler;
+       private final Map<Tuple2<Integer, Integer>, Map<Integer, Set<Integer>>> 
newToOldMappingCache = new HashMap<>(2);

Review comment:
       You are right. I needed to adjust abstractions a bit (and I think it's 
more logical now):
   - `createNewToOldMapping` is now part of `ChannelStateRescaler` (which is 
now named `SubtaskStateMapper`).
   - `ChannelRescalerRepartitioner` is renamed to `MappingBasedRepartitioner`. 
It's an pseudo-immutable class that simply applies the mapping to the state. 




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


Reply via email to