Expand description
§Temporal Join Operators
Join streaming events with versioned tables using point-in-time lookups. Temporal joins return the table value that was valid at the event’s timestamp, enabling consistent enrichment with time-varying dimension data.
§Use Cases
- Currency rate lookup at transaction time
- Product price lookup at order time
- User tier lookup at event time
- Regulatory compliance (audit trail)
§Join Types
- Event-Time: Deterministic lookup based on event timestamp (
FOR SYSTEM_TIME AS OF) - Process-Time: Non-deterministic lookup based on processing time (latest value)
§Table Characteristics
- Append-Only: Only inserts, no updates/deletes. Optimized: no stream-side state needed.
- Non-Append-Only: Has updates/deletes. Requires state to track join results for retractions.
§Example
use laminar_core::operator::temporal_join::{
TemporalJoinOperator, TemporalJoinConfig, TemporalJoinSemantics,
TableCharacteristics, TemporalJoinType,
};
// Join orders with currency rates valid at order time
let config = TemporalJoinConfig::builder()
.stream_key_column("currency".to_string())
.table_key_column("currency".to_string())
.table_version_column("valid_from".to_string())
.semantics(TemporalJoinSemantics::EventTime)
.table_characteristics(TableCharacteristics::AppendOnly)
.join_type(TemporalJoinType::Inner)
.build()
.unwrap();
let operator = TemporalJoinOperator::new(config);§SQL Syntax (Future)
-- Event-time temporal join
SELECT o.*, r.rate
FROM orders o
JOIN currency_rates FOR SYSTEM_TIME AS OF o.order_time r
ON o.currency = r.currency;
-- Process-time temporal join (latest value)
SELECT o.*, c.tier
FROM orders o
JOIN customers FOR SYSTEM_TIME AS OF PROCTIME() c
ON o.customer_id = c.id;Structs§
- Archived
Joined Event Record - An archived
JoinedEventRecord - Archived
Table Row - An archived
TableRow - Joined
Event Record - Record of a joined event for retraction tracking (non-append-only tables).
- Joined
Event Record Resolver - The resolver for an archived
JoinedEventRecord - Table
Row - A stored table row for temporal joining.
- Table
RowResolver - The resolver for an archived
TableRow - Temporal
Join Config - Configuration for a temporal join operator.
- Temporal
Join Config Builder - Builder for
TemporalJoinConfig. - Temporal
Join Metrics - Metrics for tracking temporal join operations.
- Temporal
Join Operator - Temporal join operator.
- Versioned
KeyState - Per-key versioned table state.
Enums§
- Table
Change - Table change event for non-append-only tables.
- Table
Characteristics - Table update characteristics.
- Temporal
Join Semantics - Type of temporal join semantics.
- Temporal
Join Type - Type of temporal join to perform.