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

Function order_keys_equal

nodedb-query/src/window/helpers.rs:70–81  ·  view source on GitHub ↗

Returns true when row at index `b` has the same ORDER BY key as row at index `a` (used by peer-aware ranking like RANK and PERCENT_RANK).

(
    rows: &[(String, serde_json::Value)],
    a: usize,
    b: usize,
    order_by: &[(SqlExpr, bool)],
)

Source from the content-addressed store, hash-verified

68/// Returns true when row at index `b` has the same ORDER BY key as row at
69/// index `a` (used by peer-aware ranking like RANK and PERCENT_RANK).
70pub(super) fn order_keys_equal(
71 rows: &[(String, serde_json::Value)],
72 a: usize,
73 b: usize,
74 order_by: &[(SqlExpr, bool)],
75) -> bool {
76 order_by.iter().all(|(expr, _)| {
77 let va = eval_expr_on_json(expr, &rows[a].1);
78 let vb = eval_expr_on_json(expr, &rows[b].1);
79 va == vb
80 })
81}

Callers 5

running_aggregateFunction · 0.85
apply_rankFunction · 0.85
apply_dense_rankFunction · 0.85
apply_percent_rankFunction · 0.85
apply_cume_distFunction · 0.85

Calls 3

eval_expr_on_jsonFunction · 0.85
allMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected