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

Function eval_arg_for_row

nodedb-query/src/window/value_eval.rs:161–178  ·  view source on GitHub ↗
(
    expr: &SqlExpr,
    row: &[Value],
    column_index: &HashMap<String, usize>,
)

Source from the content-addressed store, hash-verified

159// ── Argument evaluation (pub(super) for value_agg) ────────────────────────────
160
161pub(super) fn eval_arg_for_row(
162 expr: &SqlExpr,
163 row: &[Value],
164 column_index: &HashMap<String, usize>,
165) -> Value {
166 match expr {
167 SqlExpr::Column(name) => column_index
168 .get(name.as_str())
169 .and_then(|&idx| row.get(idx))
170 .cloned()
171 .unwrap_or(Value::Null),
172 SqlExpr::Literal(v) => v.clone(),
173 other => {
174 let doc = row_to_obj(row, column_index);
175 other.eval(&doc)
176 }
177 }
178}
179
180fn row_to_obj(row: &[Value], column_index: &HashMap<String, usize>) -> Value {
181 let mut map = HashMap::new();

Callers 6

partition_keyFunction · 0.85
order_keys_equal_vFunction · 0.85
collect_arg_valuesFunction · 0.85
eval_argFunction · 0.85
aggregate_v_sliceFunction · 0.85

Calls 5

row_to_objFunction · 0.85
evalMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected