Skip to main content

Module window

Module window 

Source
Expand description

§Window Operators

Implementation of various window types for stream processing.

§Window Types

  • Tumbling: Fixed-size, non-overlapping windows (implemented)
  • Sliding: Fixed-size, overlapping windows (future)
  • Session: Dynamic windows based on activity gaps (future)

§Emit Strategies

Windows support different emission strategies via EmitStrategy:

  • OnWatermark (default): Emit results when watermark passes window end
  • Periodic: Emit intermediate results at fixed intervals
  • OnUpdate: Emit after every state change (most expensive)

§Example

use laminar_core::operator::window::{
    TumblingWindowAssigner, TumblingWindowOperator, CountAggregator, EmitStrategy,
};
use std::time::Duration;

// Create a 1-minute tumbling window with count aggregation
let assigner = TumblingWindowAssigner::new(Duration::from_secs(60));
let mut operator = TumblingWindowOperator::new(
    assigner,
    CountAggregator::new(),
    Duration::from_secs(5), // 5 second grace period
);

// Emit intermediate results every 10 seconds
operator.set_emit_strategy(EmitStrategy::Periodic(Duration::from_secs(10)));

Structs§

ArchivedAvgAccumulator
An archived AvgAccumulator
ArchivedCountAccumulator
An archived CountAccumulator
ArchivedFirstValueAccumulator
An archived FirstValueAccumulator
ArchivedFirstValueF64Accumulator
An archived FirstValueF64Accumulator
ArchivedLastValueAccumulator
An archived LastValueAccumulator
ArchivedLastValueF64Accumulator
An archived LastValueF64Accumulator
ArchivedMaxAccumulator
An archived MaxAccumulator
ArchivedMinAccumulator
An archived MinAccumulator
ArchivedSumAccumulator
An archived SumAccumulator
ArchivedWindowId
An archived WindowId
AvgAccumulator
Accumulator for average aggregation.
AvgAccumulatorResolver
The resolver for an archived AvgAccumulator
AvgAggregator
Average aggregator - computes average of i64 values.
AvgF64Factory
Avg aggregator for f64 columns.
AvgF64IndexedAccumulator
f64 avg accumulator with embedded column index.
ChangelogRecord
A changelog record with Z-set weight for CDC pipelines.
CompositeAccumulator
Composite accumulator holding multiple DynAccumulator instances.
CompositeAggregator
Composite aggregator combining multiple DynAggregatorFactory instances.
CountAccumulator
Accumulator for count aggregation.
CountAccumulatorResolver
The resolver for an archived CountAccumulator
CountAggregator
Count aggregator - counts the number of events in a window.
CountDynAccumulator
Count accumulator implementing DynAccumulator.
CountDynFactory
Count factory for DynAccumulator.
FirstValueAccumulator
Accumulator for FIRST_VALUE aggregation.
FirstValueAccumulatorResolver
The resolver for an archived FirstValueAccumulator
FirstValueAggregator
FIRST_VALUE aggregator - returns the first value seen in a window.
FirstValueF64Accumulator
Accumulator for FIRST_VALUE aggregation on f64 values.
FirstValueF64AccumulatorResolver
The resolver for an archived FirstValueF64Accumulator
FirstValueF64Aggregator
FIRST_VALUE aggregator for f64 columns.
FirstValueF64DynAccumulator
FIRST_VALUE accumulator for f64 columns via DynAccumulator.
FirstValueF64DynFactory
FIRST_VALUE factory for f64 columns via DynAccumulator.
LastValueAccumulator
Accumulator for LAST_VALUE aggregation.
LastValueAccumulatorResolver
The resolver for an archived LastValueAccumulator
LastValueAggregator
LAST_VALUE aggregator - returns the last value seen in a window.
LastValueF64Accumulator
Accumulator for LAST_VALUE aggregation on f64 values.
LastValueF64AccumulatorResolver
The resolver for an archived LastValueF64Accumulator
LastValueF64Aggregator
LAST_VALUE aggregator for f64 columns.
LastValueF64DynAccumulator
LAST_VALUE accumulator for f64 columns via DynAccumulator.
LastValueF64DynFactory
LAST_VALUE factory for f64 columns via DynAccumulator.
LateDataConfig
Configuration for late data handling.
LateDataMetrics
Metrics for tracking late data.
MaxAccumulator
Accumulator for max aggregation.
MaxAccumulatorResolver
The resolver for an archived MaxAccumulator
MaxAggregator
Max aggregator - tracks maximum i64 value.
MaxF64Factory
Max aggregator for f64 columns.
MaxF64IndexedAccumulator
f64 max accumulator with embedded column index.
MinAccumulator
Accumulator for min aggregation.
MinAccumulatorResolver
The resolver for an archived MinAccumulator
MinAggregator
Min aggregator - tracks minimum i64 value.
MinF64Factory
Min aggregator for f64 columns.
MinF64IndexedAccumulator
f64 min accumulator with embedded column index.
SumAccumulator
Accumulator for sum aggregation.
SumAccumulatorResolver
The resolver for an archived SumAccumulator
SumAggregator
Sum aggregator - sums i64 values from events.
SumF64Accumulator
Accumulator for f64 sum aggregation.
SumF64Aggregator
Sum aggregator for f64 columns.
SumF64Factory
Factory for SumF64Accumulator.
SumF64IndexedAccumulator
f64 sum accumulator with embedded column index.
TumblingWindowAssigner
Tumbling window assigner.
TumblingWindowOperator
Tumbling window operator.
WindowCloseMetrics
Metrics for tracking window close behavior.
WindowId
Unique identifier for a window.
WindowIdResolver
The resolver for an archived WindowId

Enums§

ArchivedCdcOperation
An archived CdcOperation
CdcOperation
CDC operation type for changelog records.
CdcOperationResolver
The resolver for an archived CdcOperation
EmitStrategy
Strategy for when window results should be emitted.
ScalarResult
Scalar result type supporting multiple numeric types.

Traits§

Accumulator
Accumulator state for aggregations.
Aggregator
Trait for window aggregation functions.
DynAccumulator
Dynamic accumulator trait for composite aggregation.
DynAggregatorFactory
Factory trait for creating DynAccumulator instances.
ResultToArrow
Trait for converting aggregation results to Arrow arrays.
ResultToI64
Trait for converting aggregation results to i64 for output.
WindowAssigner
Trait for assigning events to windows.

Type Aliases§

WindowIdVec
Collection type for window assignments.