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 endPeriodic: Emit intermediate results at fixed intervalsOnUpdate: 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§
- Archived
AvgAccumulator - An archived
AvgAccumulator - Archived
Count Accumulator - An archived
CountAccumulator - Archived
First Value Accumulator - An archived
FirstValueAccumulator - Archived
First Value F64Accumulator - An archived
FirstValueF64Accumulator - Archived
Last Value Accumulator - An archived
LastValueAccumulator - Archived
Last Value F64Accumulator - An archived
LastValueF64Accumulator - Archived
MaxAccumulator - An archived
MaxAccumulator - Archived
MinAccumulator - An archived
MinAccumulator - Archived
SumAccumulator - An archived
SumAccumulator - Archived
Window Id - An archived
WindowId - AvgAccumulator
- Accumulator for average aggregation.
- AvgAccumulator
Resolver - The resolver for an archived
AvgAccumulator - AvgAggregator
- Average aggregator - computes average of i64 values.
- AvgF64
Factory - Avg aggregator for f64 columns.
- AvgF64
Indexed Accumulator - f64 avg accumulator with embedded column index.
- Changelog
Record - A changelog record with Z-set weight for CDC pipelines.
- Composite
Accumulator - Composite accumulator holding multiple
DynAccumulatorinstances. - Composite
Aggregator - Composite aggregator combining multiple
DynAggregatorFactoryinstances. - Count
Accumulator - Accumulator for count aggregation.
- Count
Accumulator Resolver - The resolver for an archived
CountAccumulator - Count
Aggregator - Count aggregator - counts the number of events in a window.
- Count
DynAccumulator - Count accumulator implementing
DynAccumulator. - Count
DynFactory - Count factory for
DynAccumulator. - First
Value Accumulator - Accumulator for
FIRST_VALUEaggregation. - First
Value Accumulator Resolver - The resolver for an archived
FirstValueAccumulator - First
Value Aggregator FIRST_VALUEaggregator - returns the first value seen in a window.- First
Value F64Accumulator - Accumulator for
FIRST_VALUEaggregation on f64 values. - First
Value F64Accumulator Resolver - The resolver for an archived
FirstValueF64Accumulator - First
Value F64Aggregator FIRST_VALUEaggregator for f64 columns.- First
Value F64Dyn Accumulator FIRST_VALUEaccumulator for f64 columns viaDynAccumulator.- First
Value F64Dyn Factory FIRST_VALUEfactory for f64 columns viaDynAccumulator.- Last
Value Accumulator - Accumulator for
LAST_VALUEaggregation. - Last
Value Accumulator Resolver - The resolver for an archived
LastValueAccumulator - Last
Value Aggregator LAST_VALUEaggregator - returns the last value seen in a window.- Last
Value F64Accumulator - Accumulator for
LAST_VALUEaggregation on f64 values. - Last
Value F64Accumulator Resolver - The resolver for an archived
LastValueF64Accumulator - Last
Value F64Aggregator LAST_VALUEaggregator for f64 columns.- Last
Value F64Dyn Accumulator LAST_VALUEaccumulator for f64 columns viaDynAccumulator.- Last
Value F64Dyn Factory LAST_VALUEfactory for f64 columns viaDynAccumulator.- Late
Data Config - Configuration for late data handling.
- Late
Data Metrics - Metrics for tracking late data.
- MaxAccumulator
- Accumulator for max aggregation.
- MaxAccumulator
Resolver - The resolver for an archived
MaxAccumulator - MaxAggregator
- Max aggregator - tracks maximum i64 value.
- MaxF64
Factory - Max aggregator for f64 columns.
- MaxF64
Indexed Accumulator - f64 max accumulator with embedded column index.
- MinAccumulator
- Accumulator for min aggregation.
- MinAccumulator
Resolver - The resolver for an archived
MinAccumulator - MinAggregator
- Min aggregator - tracks minimum i64 value.
- MinF64
Factory - Min aggregator for f64 columns.
- MinF64
Indexed Accumulator - f64 min accumulator with embedded column index.
- SumAccumulator
- Accumulator for sum aggregation.
- SumAccumulator
Resolver - The resolver for an archived
SumAccumulator - SumAggregator
- Sum aggregator - sums i64 values from events.
- SumF64
Accumulator - Accumulator for f64 sum aggregation.
- SumF64
Aggregator - Sum aggregator for f64 columns.
- SumF64
Factory - Factory for
SumF64Accumulator. - SumF64
Indexed Accumulator - f64 sum accumulator with embedded column index.
- Tumbling
Window Assigner - Tumbling window assigner.
- Tumbling
Window Operator - Tumbling window operator.
- Window
Close Metrics - Metrics for tracking window close behavior.
- Window
Id - Unique identifier for a window.
- Window
IdResolver - The resolver for an archived
WindowId
Enums§
- Archived
CdcOperation - An archived
CdcOperation - CdcOperation
- CDC operation type for changelog records.
- CdcOperation
Resolver - The resolver for an archived
CdcOperation - Emit
Strategy - Strategy for when window results should be emitted.
- Scalar
Result - 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.
- DynAggregator
Factory - Factory trait for creating
DynAccumulatorinstances. - Result
ToArrow - Trait for converting aggregation results to Arrow arrays.
- Result
ToI64 - Trait for converting aggregation results to i64 for output.
- Window
Assigner - Trait for assigning events to windows.
Type Aliases§
- Window
IdVec - Collection type for window assignments.