pub enum EmitStrategy {
OnWatermark,
Periodic(Duration),
OnUpdate,
OnWindowClose,
Changelog,
Final,
}Expand description
Strategy for when window results should be emitted.
This controls the trade-off between result freshness and efficiency:
OnWatermarkis most efficient but has highest latencyPeriodicbalances freshness and efficiencyOnUpdateprovides lowest latency but highest overheadOnWindowClose(F011B) is for append-only sinksChangelog(F011B) emits Z-set weighted records for CDCFinal(F011B) suppresses all intermediate results
Variants§
OnWatermark
Emit final results when watermark passes window end (default).
This is the most efficient strategy as it only emits once per window. Results are guaranteed to be complete (within allowed lateness bounds). May emit retractions if late data arrives within lateness bounds.
Periodic(Duration)
Emit intermediate results at fixed intervals.
Useful for dashboards and monitoring where periodic updates are needed before the window closes. The final result is still emitted on watermark.
The duration specifies the interval between periodic emissions.
OnUpdate
Emit updated results after every state change.
This provides the lowest latency for result visibility but has the highest overhead. Each incoming event triggers an emission.
Use with caution for high-volume streams.
OnWindowClose
Emit ONLY when watermark passes window end. No intermediate emissions.
Critical for append-only sinks (Kafka, S3, Delta Lake, Iceberg).
Unlike OnWatermark, this NEVER emits before window close, even with
late data retractions. Late data is buffered until next window close.
Key difference from OnWatermark:
OnWatermark: May emit retractions for late dataOnWindowClose: Buffers late data, only emits final result
SQL: EMIT ON WINDOW CLOSE
Changelog
Emit changelog records with Z-set weights.
Every emission includes operation type and weight:
- Insert (+1 weight)
- Delete (-1 weight)
- Update (retraction pair: -1 old, +1 new)
Required for:
- CDC pipelines
- Cascading materialized views (F060)
- Downstream consumers that need to track changes
SQL: EMIT CHANGES
Final
Suppress ALL intermediate results, emit only finalized.
Similar to OnWindowClose but also suppresses:
- Periodic emissions (even if Periodic was set elsewhere)
- Late data retractions (drops late data entirely after window close)
Use for BI reporting where only final, exact results matter.
SQL: EMIT FINAL
Implementations§
Source§impl EmitStrategy
impl EmitStrategy
Sourcepub fn needs_periodic_timer(&self) -> bool
pub fn needs_periodic_timer(&self) -> bool
Returns true if this strategy requires periodic timer registration.
Sourcepub fn periodic_interval(&self) -> Option<Duration>
pub fn periodic_interval(&self) -> Option<Duration>
Returns the periodic interval if this is a periodic strategy.
Sourcepub fn emits_on_update(&self) -> bool
pub fn emits_on_update(&self) -> bool
Returns true if results should be emitted on every update.
Sourcepub fn emits_intermediate(&self) -> bool
pub fn emits_intermediate(&self) -> bool
Returns true if this strategy emits intermediate results.
Strategies that emit intermediate results (before window close):
OnUpdate: emits after every state changePeriodic: emits at fixed intervals
Strategies that do NOT emit intermediate results:
OnWatermark: waits for watermarkOnWindowClose: only emits when window closesChangelog: depends on trigger, but typically on watermarkFinal: only emits final result
Sourcepub fn requires_changelog(&self) -> bool
pub fn requires_changelog(&self) -> bool
Returns true if this strategy requires changelog/Z-set support.
The Changelog strategy requires the operator to track previous
values and emit insert/delete/update records with weights.
Sourcepub fn is_append_only_compatible(&self) -> bool
pub fn is_append_only_compatible(&self) -> bool
Returns true if this strategy is suitable for append-only sinks.
Append-only sinks (Kafka, S3, Delta Lake, Iceberg) cannot handle retractions or updates. Only these strategies are safe:
OnWindowClose: guarantees single emission per windowFinal: suppresses all intermediate results
Sourcepub fn generates_retractions(&self) -> bool
pub fn generates_retractions(&self) -> bool
Returns true if late data should generate retractions.
Strategies that generate retractions for late data:
OnWatermark: may retract previous resultOnUpdate: immediately emits updated resultChangelog: emits -old/+new pair
Strategies that do NOT generate retractions:
OnWindowClose: buffers late dataFinal: drops late dataPeriodic: depends on whether window is still open
Sourcepub fn suppresses_intermediate(&self) -> bool
pub fn suppresses_intermediate(&self) -> bool
Returns true if this strategy should suppress intermediate emissions.
Used to override periodic timers when a suppressing strategy is active.
Sourcepub fn drops_late_data(&self) -> bool
pub fn drops_late_data(&self) -> bool
Returns true if late data should be dropped entirely.
The Final strategy drops late data to ensure only exact,
finalized results are emitted.
Trait Implementations§
Source§impl Clone for EmitStrategy
impl Clone for EmitStrategy
Source§fn clone(&self) -> EmitStrategy
fn clone(&self) -> EmitStrategy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EmitStrategy
impl Debug for EmitStrategy
Source§impl Default for EmitStrategy
impl Default for EmitStrategy
Source§fn default() -> EmitStrategy
fn default() -> EmitStrategy
Source§impl PartialEq for EmitStrategy
impl PartialEq for EmitStrategy
impl Eq for EmitStrategy
impl StructuralPartialEq for EmitStrategy
Auto Trait Implementations§
impl Freeze for EmitStrategy
impl RefUnwindSafe for EmitStrategy
impl Send for EmitStrategy
impl Sync for EmitStrategy
impl Unpin for EmitStrategy
impl UnwindSafe for EmitStrategy
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.