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>
Keep only rows where time_column >= watermark. Returns
Ok(None) when nothing survives; passes through untouched
while the watermark is uninitialised (< 0).
§Errors
DataFusionError::Plan when time_column is missing or isn’t
a Timestamp(_) (propagated from filter_batch_by_timestamp).
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§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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