pub struct WatermarkDynamicFilter { /* private fields */ }Expand description
Dynamic filter that drops rows older than the current watermark.
Holds a shared watermark atomic (same as super::watermark_udf::WatermarkUdf)
and a monotonic generation counter that increments on each watermark
advance. The generation lets downstream consumers detect stale state
without comparing full watermark values.
Implementations§
Source§impl WatermarkDynamicFilter
impl WatermarkDynamicFilter
Sourcepub fn new(
watermark_ms: Arc<AtomicI64>,
generation: Arc<AtomicU64>,
time_column: String,
) -> Self
pub fn new( watermark_ms: Arc<AtomicI64>, generation: Arc<AtomicU64>, time_column: String, ) -> Self
Creates a new watermark filter.
§Arguments
watermark_ms- Shared atomic holding the current watermark in epoch milliseconds. Values < 0 mean “uninitialized”.generation- Monotonic counter incremented on each advance.time_column- Name of the event-time column in record batches.
Sourcepub fn advance_watermark(&self, new_ms: i64)
pub fn advance_watermark(&self, new_ms: i64)
Advances the watermark if new_ms exceeds the current value.
On a successful advance the generation counter is incremented.
No-op when new_ms <= current.
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Returns the current generation (monotonically increasing).
Sourcepub fn watermark_ms(&self) -> i64
pub fn watermark_ms(&self) -> i64
Returns the current watermark in epoch milliseconds.
Sourcepub fn filter_batch(
&self,
batch: &RecordBatch,
) -> Result<Option<RecordBatch>, DataFusionError>
pub fn filter_batch( &self, batch: &RecordBatch, ) -> Result<Option<RecordBatch>, DataFusionError>
Filters a record batch, keeping only rows where time_column >= watermark.
Returns Ok(None) when all rows are filtered out.
When watermark < 0 (uninitialized), all rows pass through.
Handles both Int64 (epoch millis) and Timestamp(Millisecond, _) columns.
§Errors
Returns an error if the time column is missing or has an unsupported type.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WatermarkDynamicFilter
impl RefUnwindSafe for WatermarkDynamicFilter
impl Send for WatermarkDynamicFilter
impl Sync for WatermarkDynamicFilter
impl Unpin for WatermarkDynamicFilter
impl UnsafeUnpin for WatermarkDynamicFilter
impl UnwindSafe for WatermarkDynamicFilter
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more