MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / update_mv

Function update_mv

nodedb/src/event/streaming_mv/processor.rs:103–121  ·  view source on GitHub ↗

Update a single MV's state from a CdcEvent.

(event: &CdcEvent, mv_state: &MvState)

Source from the content-addressed store, hash-verified

101
102/// Update a single MV's state from a CdcEvent.
103fn update_mv(event: &CdcEvent, mv_state: &MvState) {
104 // Extract GROUP BY key from the event.
105 let group_key = extract_group_key(event, &mv_state.group_by_columns);
106
107 // Extract aggregate values from the event.
108 let agg_values: Vec<f64> = mv_state
109 .aggregates
110 .iter()
111 .map(|agg| extract_agg_value(event, agg.function, &agg.input_expr))
112 .collect();
113
114 mv_state.update_with_time(&group_key, &agg_values, event.event_time);
115
116 trace!(
117 mv = %mv_state.name,
118 group_key = %group_key,
119 "streaming MV updated"
120 );
121}
122
123/// Extract the GROUP BY key by concatenating column values from the event.
124///

Callers 3

process_event_for_mvsFunction · 0.85
backfill_from_bufferFunction · 0.85

Calls 5

extract_group_keyFunction · 0.85
extract_agg_valueFunction · 0.85
collectMethod · 0.80
update_with_timeMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected