Skip to content

Commit 0d940c5

Browse files
committed
refactor: purge all stale NDJSON/JSON/PageProcessor references
- local-executor: replace JSON.stringify cache key with FNV-1a hash - decode.ts: fix comment referencing "JSON filter values" - SVG + excalidraw: NDJSON → columnar binary streaming, PageProcessor → operator pipeline, JSON return → RPC zero serialization
1 parent f603add commit 0d940c5

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

docs/architecture/querymode-architecture.svg

Lines changed: 1 addition & 1 deletion
Loading

src/decode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ function vectorSearch(
348348

349349
// --- Filters ---
350350

351-
/** Coerce bigint↔number for cross-type comparisons (JSON filter values are numbers, int64 columns decode as bigint). */
351+
/** Coerce bigint↔number for cross-type comparisons (filter values are numbers, int64 columns decode as bigint). */
352352
function coerceCompare(a: unknown, b: unknown): [unknown, unknown] {
353353
if (typeof a === "bigint" && typeof b === "number") return [a, BigInt(Math.trunc(b))];
354354
if (typeof a === "number" && typeof b === "bigint") return [BigInt(Math.trunc(a)), b];

src/local-executor.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,21 @@ export class LocalExecutor implements QueryExecutor {
337337
return cached;
338338
}
339339

340-
/** Build a cache key from query descriptor. */
340+
/** Build a cache key from query descriptor — no serialization. */
341341
private queryCacheKey(query: QueryDescriptor): string {
342-
const { table, filters, projections, sortColumn, sortDirection, limit, offset, aggregates, groupBy } = query;
343-
return `qr:${table}:${JSON.stringify({ filters, projections, sortColumn, sortDirection, limit, offset, aggregates, groupBy })}`;
342+
let h = 0x811c9dc5;
343+
const feed = (s: string) => { for (let i = 0; i < s.length; i++) { h ^= s.charCodeAt(i); h = Math.imul(h, 0x01000193); } };
344+
feed(query.table);
345+
for (const f of [...query.filters].sort((a, b) => a.column.localeCompare(b.column) || a.op.localeCompare(b.op))) {
346+
feed(f.column); feed(f.op); feed(String(f.value));
347+
}
348+
for (const p of [...query.projections].sort()) feed(p);
349+
if (query.sortColumn) { feed(query.sortColumn); feed(query.sortDirection ?? "asc"); }
350+
if (query.limit !== undefined) feed(String(query.limit));
351+
if (query.offset !== undefined) feed(String(query.offset));
352+
if (query.aggregates) for (const a of query.aggregates) { feed(a.fn); feed(a.column); if (a.alias) feed(a.alias); }
353+
if (query.groupBy) for (const g of query.groupBy) feed(g);
354+
return `qr:${query.table}:${(h >>> 0).toString(36)}`;
344355
}
345356

346357
async execute(query: QueryDescriptor): Promise<QueryResult> {

0 commit comments

Comments
 (0)