MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / with_agg_build_key

Function with_agg_build_key

src/cypher/cypher.c:3835–3849  ·  view source on GitHub ↗

Build a group key from non-aggregate WITH items */

Source from the content-addressed store, hash-verified

3833
3834/* Build a group key from non-aggregate WITH items */
3835static int with_agg_build_key(cbm_return_clause_t *wc, binding_t *b, char *key, size_t key_sz) {
3836 int kl = 0;
3837 for (int ci = 0; ci < wc->count; ci++) {
3838 if (is_aggregate_func(wc->items[ci].func)) {
3839 continue;
3840 }
3841 char vbuf[CBM_SZ_512];
3842 const char *v = project_item(b, &wc->items[ci], vbuf, sizeof(vbuf));
3843 kl += snprintf(key + kl, key_sz - (size_t)kl, "%s|", v);
3844 if (kl >= (int)key_sz) {
3845 kl = (int)key_sz - SKIP_ONE;
3846 }
3847 }
3848 return kl;
3849}
3850
3851/* Find or create an aggregation group. Returns index. */
3852static int with_agg_find_or_create(with_agg_t **aggs, int *agg_cnt, int *agg_cap,

Callers 1

execute_with_aggregateFunction · 0.85

Calls 2

is_aggregate_funcFunction · 0.85
project_itemFunction · 0.85

Tested by

no test coverage detected