reswqa commented on code in PR #24541:
URL: https://github.com/apache/flink/pull/24541#discussion_r1607875012


##########
flink-datastream/src/main/java/org/apache/flink/datastream/impl/context/DefaultNonPartitionedContext.java:
##########
@@ -18,23 +18,61 @@
 
 package org.apache.flink.datastream.impl.context;
 
+import org.apache.flink.datastream.api.common.Collector;
 import org.apache.flink.datastream.api.context.JobInfo;
 import org.apache.flink.datastream.api.context.NonPartitionedContext;
 import org.apache.flink.datastream.api.context.TaskInfo;
 import org.apache.flink.datastream.api.function.ApplyPartitionFunction;
 import org.apache.flink.metrics.MetricGroup;
 
+import java.util.Set;
+
 /** The default implementation of {@link NonPartitionedContext}. */
 public class DefaultNonPartitionedContext<OUT> implements 
NonPartitionedContext<OUT> {
     private final DefaultRuntimeContext context;
 
-    public DefaultNonPartitionedContext(DefaultRuntimeContext context) {
+    private final DefaultPartitionedContext partitionedContext;
+
+    private final Collector<OUT> collector;
+
+    private final boolean isKeyed;
+
+    private final Set<Object> keySet;
+
+    public DefaultNonPartitionedContext(
+            DefaultRuntimeContext context,
+            DefaultPartitionedContext partitionedContext,
+            Collector<OUT> collector,
+            boolean isKeyed,
+            Set<Object> keySet) {
         this.context = context;
+        this.partitionedContext = partitionedContext;
+        this.collector = collector;
+        this.isKeyed = isKeyed;
+        this.keySet = keySet;
     }
 
     @Override
-    public void applyToAllPartitions(ApplyPartitionFunction<OUT> 
applyPartitionFunction) {
-        // TODO implements this method.
+    public void applyToAllPartitions(ApplyPartitionFunction<OUT> 
applyPartitionFunction)
+            throws Exception {
+        if (isKeyed) {
+            for (Object key : keySet) {

Review Comment:
   That's a good question! Theoretically, we should put it in something like 
state, but support for state will have to wait until the next PR, and we'll 
shall support resuming it from cp in the future commit I think.



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to