Do I need to set assignTimestampsAndWatermarks if I set my time characteristic to IngestionTime?
say I set my time characteristic of stream execution environment to Ingestion time as follows
streamExecutionEnvironment.setStreamTimeCharacteristic(TimeCharacteristic.IngestionTime);
do I need to call datastream.assignTimestampsAndWatermarks(AscendingTimestampExtractor)
?
I thought datastream.assignTimestampsAndWatermarks
is mandatory only if time characteristic is event time. No? If not, I am wondering how can I set AscendingTimestampExtractor
in a distributed environment? is there any way to add monotonically increasing long(AscendingTimestampExtractor) without any distributed locks?
No, there is no need to call assignTimestampsAndWatermarks
when using ingestion time. With ingestion time, Flink assigns timestamps and watermarks automatically.
Also, there is never any need to worry about distributed locking when doing watermarking. Each local instance assigns watermarks locally, based on its knowledge of the local streams. For an AscendingTimestampExtractor
it's enough that the timestamps are monotonically increasing in each instance.