[ 
https://issues.apache.org/jira/browse/BEAM-6751?focusedWorklogId=208045&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-208045
 ]

ASF GitHub Bot logged work on BEAM-6751:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Mar/19 20:39
            Start Date: 05/Mar/19 20:39
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on pull request #7991: 
[BEAM-6751] Add KafkaIO EOS support to Flink via @RequiresStableInput
URL: https://github.com/apache/beam/pull/7991#discussion_r262643718
 
 

 ##########
 File path: 
runners/flink/src/main/java/org/apache/beam/runners/flink/translation/wrappers/streaming/stableinput/BufferedElements.java
 ##########
 @@ -0,0 +1,127 @@
+/*
+ * 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.beam.runners.flink.translation.wrappers.streaming.stableinput;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Collections;
+import java.util.List;
+import org.apache.beam.runners.core.DoFnRunner;
+import org.apache.beam.sdk.coders.Coder;
+import org.apache.beam.sdk.coders.InstantCoder;
+import org.apache.beam.sdk.coders.StringUtf8Coder;
+import org.apache.beam.sdk.state.TimeDomain;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.util.WindowedValue;
+import org.joda.time.Instant;
+
+/** Elements which can be buffered as part of a checkpoint for 
@RequiresStableInput. */
+class BufferedElements {
+
+  static class Timer implements BufferedElement {
+
+    private final String timerId;
+    private final BoundedWindow window;
+    private final Instant timestamp;
+    private final TimeDomain timeDomain;
+
+    Timer(String timerId, BoundedWindow window, Instant timestamp, TimeDomain 
timeDomain) {
+      this.timerId = timerId;
+      this.window = window;
+      this.timestamp = timestamp;
+      this.timeDomain = timeDomain;
+    }
+
+    @Override
+    public void processWith(DoFnRunner doFnRunner) {
+      doFnRunner.onTimer(timerId, window, timestamp, timeDomain);
+    }
+  }
+
+  static class Element implements BufferedElement {
+    private final WindowedValue element;
+
+    Element(WindowedValue element) {
+      this.element = element;
+    }
+
+    @Override
+    public void processWith(DoFnRunner doFnRunner) {
+      doFnRunner.processElement(element);
+    }
+  }
+
+  static class BufferedElementCoder extends Coder<BufferedElement> {
 
 Review comment:
   Would be good to have defensive tests for the coder
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 208045)
    Time Spent: 2h 40m  (was: 2.5h)

> KafkaIO's EOS mode does not work with FlinkRunner
> -------------------------------------------------
>
>                 Key: BEAM-6751
>                 URL: https://issues.apache.org/jira/browse/BEAM-6751
>             Project: Beam
>          Issue Type: Bug
>          Components: io-java-kafka, runner-flink
>            Reporter: Maximilian Michels
>            Assignee: Maximilian Michels
>            Priority: Major
>             Fix For: 2.12.0
>
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> KafkaIO has a validation check which whitelists certain runners capable of 
> provide exactly-once semantics:
> {noformat}
>         if ("org.apache.beam.runners.direct.DirectRunner".equals(runner)
>             || runner.startsWith("org.apache.beam.runners.dataflow.")
>             || runner.startsWith("org.apache.beam.runners.spark.") {
> ...
> {noformat}
> The Flink supports exactly-once checkpointing but the Flink Runner can't 
> utilize it in the way KafkaIO intends it.
> I think we should remove the check in favor of checking for translation of 
> {{@RequiresStableInput}}. Changes to KafkaIO might have to be made to support 
> EOS efficiently with the Flink Runner.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to