Class PeriodicWatermarkAssignerWrapper

    • Constructor Detail

      • PeriodicWatermarkAssignerWrapper

        public PeriodicWatermarkAssignerWrapper​(PeriodicWatermarkAssigner assigner,
                                                int timeFieldIdx)
        Parameters:
        timeFieldIdx - the index of the rowtime attribute.
        assigner - the watermark assigner.
    • Method Detail

      • getCurrentWatermark

        @Nullable
        public Watermark getCurrentWatermark()
        Description copied from interface: WatermarkStrategyWithPeriodicWatermarks
        Returns the current watermark. This method is periodically called by the system to retrieve the current watermark. The method may return null to indicate that no new Watermark is available.

        The returned watermark will be emitted only if it is non-null and its timestamp is larger than that of the previously emitted watermark (to preserve the contract of ascending watermarks). If the current watermark is still identical to the previous one, no progress in event time has happened since the previous call to this method. If a null value is returned, or the timestamp of the returned watermark is smaller than that of the last emitted one, then no new watermark will be generated.

        The interval in which this method is called and Watermarks are generated depends on ExecutionConfig.getAutoWatermarkInterval().

        Specified by:
        getCurrentWatermark in interface WatermarkStrategyWithPeriodicWatermarks<RowData>
        Returns:
        Null, if no watermark should be emitted, or the next watermark to emit.
        See Also:
        Watermark, ExecutionConfig.getAutoWatermarkInterval()
      • extractTimestamp

        public long extractTimestamp​(RowData row,
                                     long recordTimestamp)
        Description copied from interface: TimestampAssigner
        Assigns a timestamp to an element, in milliseconds since the Epoch. This is independent of any particular time zone or calendar.

        The method is passed the previously assigned timestamp of the element. That previous timestamp may have been assigned from a previous assigner. If the element did not carry a timestamp before, this value is TimestampAssigner.NO_TIMESTAMP (= Long.MIN_VALUE: -9223372036854775808L).

        Specified by:
        extractTimestamp in interface TimestampAssigner<RowData>
        Parameters:
        row - The element that the timestamp will be assigned to.
        recordTimestamp - The current internal timestamp of the element, or a negative value, if no timestamp has been assigned yet.
        Returns:
        The new timestamp.