MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / arrayDimStatement

Function arrayDimStatement

telemetry-worker/src/rollup.ts:132–139  ·  view source on GitHub ↗

* One dimension unnested from a JSON array prop — one row per element, so an index * of a TypeScript+Go repo counts once under each language. `json_each` over a path * the props do not have yields no rows, which is exactly the wanted behaviour for * events that omit the array.

(dim: string, path: string, events: readonly string[])

Source from the content-addressed store, hash-verified

130 * events that omit the array.
131 */
132function arrayDimStatement(dim: string, path: string, events: readonly string[]): string {
133 return `INSERT INTO daily_dim_counts (day, event, dim, value, count, machines)
134 SELECT e.day, e.event, '${dim}', CAST(j.value AS TEXT), count(*), count(DISTINCT e.machine_id)
135 FROM events e, json_each(e.props, '${path}') j
136 WHERE e.day = ? AND e.event IN (${quoted(events)}) AND j.value <> ''
137 GROUP BY e.day, e.event, j.value
138 ${DIM_CONFLICT}`;
139}
140
141/**
142 * Rebuilt from `machine_days`, not from `events`: that table is never purged, so this

Callers 1

rollup.tsFile · 0.85

Calls 1

quotedFunction · 0.70

Tested by

no test coverage detected