johnyangk closed pull request #156: [NEMO-279] Finish BeamUnboundedSource when
emitting TIMESTAMP_MAX_VALUE
URL: https://github.com/apache/incubator-nemo/pull/156
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/source/BeamUnboundedSourceVertex.java
b/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/source/BeamUnboundedSourceVertex.java
index 482dd9d1a..ad40d1b1f 100644
---
a/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/source/BeamUnboundedSourceVertex.java
+++
b/compiler/frontend/beam/src/main/java/org/apache/nemo/compiler/frontend/beam/source/BeamUnboundedSourceVertex.java
@@ -20,10 +20,12 @@
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.beam.sdk.io.UnboundedSource;
+import org.apache.beam.sdk.transforms.windowing.GlobalWindow;
import org.apache.beam.sdk.util.WindowedValue;
import org.apache.nemo.common.ir.Readable;
import org.apache.nemo.common.ir.vertex.IRVertex;
import org.apache.nemo.common.ir.vertex.SourceVertex;
+import org.joda.time.Instant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -101,6 +103,7 @@ public ObjectNode getPropertiesAsJsonNode() {
private UnboundedSource.UnboundedReader<O> reader;
private boolean isStarted = false;
private boolean isCurrentAvailable = false;
+ private boolean isFinished = false;
UnboundedSourceReadable(final UnboundedSource<O, M> unboundedSource) {
this.unboundedSource = unboundedSource;
@@ -138,12 +141,15 @@ public Object readCurrent() {
@Override
public long readWatermark() {
- return reader.getWatermark().getMillis();
+ final Instant watermark = reader.getWatermark();
+ // Finish if the watermark == TIMESTAMP_MAX_VALUE
+ isFinished = (watermark.getMillis() >=
GlobalWindow.TIMESTAMP_MAX_VALUE.getMillis());
+ return watermark.getMillis();
}
@Override
public boolean isFinished() {
- return false;
+ return isFinished;
}
@Override
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services