T - The type of emitted records.@Internal public class SourceOutputWithWatermarks<T> extends Object implements org.apache.flink.api.connector.source.SourceOutput<T>
PushingAsyncDataInput.DataOutput. The watermarks are pushed into the same output, or into
a separate WatermarkOutput, if one is provided.
This output does not implement automatic periodic watermark emission. The method emitPeriodicWatermark() needs to be called periodically.
The methods SourceOutput.collect(Object) and SourceOutput.collect(Object,
long) are highly performance-critical (part of the hot loop). To make the code as JIT friendly
as possible, we want to have only a single implementation of these two methods, across all
classes. That way, the JIT compiler can de-virtualize (and inline) them better.
Currently, we have one implementation of these methods for the case where we don't need
watermarks (see class NoOpTimestampsAndWatermarks) and one for the case where we do (this
class). When the JVM is dedicated to a single job (or type of job) only one of these classes will
be loaded. In mixed job setups, we still have a bimorphic method (rather than a
poly/-/mega-morphic method).
| Modifier | Constructor and Description |
|---|---|
protected |
SourceOutputWithWatermarks(PushingAsyncDataInput.DataOutput<T> recordsOutput,
org.apache.flink.api.common.eventtime.WatermarkOutput onEventWatermarkOutput,
org.apache.flink.api.common.eventtime.WatermarkOutput periodicWatermarkOutput,
org.apache.flink.api.common.eventtime.TimestampAssigner<T> timestampAssigner,
org.apache.flink.api.common.eventtime.WatermarkGenerator<T> watermarkGenerator)
Creates a new SourceOutputWithWatermarks that emits records to the given DataOutput and
watermarks to the (possibly different) WatermarkOutput.
|
| Modifier and Type | Method and Description |
|---|---|
void |
collect(T record) |
void |
collect(T record,
long timestamp) |
static <E> SourceOutputWithWatermarks<E> |
createWithSeparateOutputs(PushingAsyncDataInput.DataOutput<E> recordsOutput,
org.apache.flink.api.common.eventtime.WatermarkOutput onEventWatermarkOutput,
org.apache.flink.api.common.eventtime.WatermarkOutput periodicWatermarkOutput,
org.apache.flink.api.common.eventtime.TimestampAssigner<E> timestampAssigner,
org.apache.flink.api.common.eventtime.WatermarkGenerator<E> watermarkGenerator)
Creates a new SourceOutputWithWatermarks that emits records to the given DataOutput and
watermarks to the different WatermarkOutputs.
|
void |
emitPeriodicWatermark() |
void |
emitWatermark(org.apache.flink.api.common.eventtime.Watermark watermark) |
void |
markActive() |
void |
markIdle() |
protected SourceOutputWithWatermarks(PushingAsyncDataInput.DataOutput<T> recordsOutput, org.apache.flink.api.common.eventtime.WatermarkOutput onEventWatermarkOutput, org.apache.flink.api.common.eventtime.WatermarkOutput periodicWatermarkOutput, org.apache.flink.api.common.eventtime.TimestampAssigner<T> timestampAssigner, org.apache.flink.api.common.eventtime.WatermarkGenerator<T> watermarkGenerator)
public final void collect(T record)
collect in interface org.apache.flink.api.connector.source.SourceOutput<T>public final void collect(T record, long timestamp)
collect in interface org.apache.flink.api.connector.source.SourceOutput<T>public final void emitWatermark(org.apache.flink.api.common.eventtime.Watermark watermark)
emitWatermark in interface org.apache.flink.api.common.eventtime.WatermarkOutputpublic final void markIdle()
markIdle in interface org.apache.flink.api.common.eventtime.WatermarkOutputpublic void markActive()
markActive in interface org.apache.flink.api.common.eventtime.WatermarkOutputpublic final void emitPeriodicWatermark()
public static <E> SourceOutputWithWatermarks<E> createWithSeparateOutputs(PushingAsyncDataInput.DataOutput<E> recordsOutput, org.apache.flink.api.common.eventtime.WatermarkOutput onEventWatermarkOutput, org.apache.flink.api.common.eventtime.WatermarkOutput periodicWatermarkOutput, org.apache.flink.api.common.eventtime.TimestampAssigner<E> timestampAssigner, org.apache.flink.api.common.eventtime.WatermarkGenerator<E> watermarkGenerator)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.