Interface SupportsWatermarkPushDown
-
- All Known Implementing Classes:
TestScanTableSourceWithWatermarkPushDown
@PublicEvolving public interface SupportsWatermarkPushDown
Enables to push down a watermark strategy into aScanTableSource
.The concept of watermarks defines when time operations based on an event time attribute will be triggered. A watermark tells operators that no elements with a timestamp older or equal to the watermark timestamp should arrive at the operator. Thus, watermarks are a trade-off between latency and completeness.
Given the following SQL:
CREATE TABLE t (i INT, ts TIMESTAMP(3), WATERMARK FOR ts AS ts - INTERVAL '5' SECOND) // `ts` becomes a time attribute
In the above example, generated watermarks are lagging 5 seconds behind the highest seen timestamp.
For correctness, it might be necessary to perform the watermark generation as early as possible in order to be close to the actual data generation within a source's data partition.
If the
ScanTableSource.getScanRuntimeProvider(ScanTableSource.ScanContext)
returnsSourceProvider
, watermarks will be automatically pushed into the runtime source operator by the framework. In this case, this interface does not need to be implemented.If the
ScanTableSource
does not return aSourceProvider
and this interface is not implemented, watermarks are generated in a subsequent operation after the source. In this case, it is recommended to implement this interface to perform the watermark generation within source's data partition.This interface provides a
WatermarkStrategy
that needs to be applied to the runtime implementation. Most built-in Flink sources provide a way of setting the watermark generator.- See Also:
SupportsSourceWatermark
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
applyWatermark(WatermarkStrategy<RowData> watermarkStrategy)
Provides aWatermarkStrategy
which defines how to generateWatermark
s in the stream source.
-
-
-
Method Detail
-
applyWatermark
void applyWatermark(WatermarkStrategy<RowData> watermarkStrategy)
Provides aWatermarkStrategy
which defines how to generateWatermark
s in the stream source.The
WatermarkStrategy
is a builder/factory for the actual runtime implementation consisting ofTimestampAssigner
(assigns the event-time timestamps to each record) and theWatermarkGenerator
(generates the watermarks).Note: If necessary, the watermark strategy will contain required computed column expressions and consider metadata columns (if
SupportsReadingMetadata
is implemented).
-
-