The Problem
A page of rows can look like a complete answer even when more matches exist. Client Data Studio and Custom Reports need each response to identify its source, requested window, returned rows, and known coverage.
My Contribution
I built this browser query runtime for K2POV; it powers Client Data Studio and query-backed Custom Reports.
How It Works
- 01The host application owns the catalog, field mappings, capabilities, and access checks. A browser Worker resolves the dataset and fields, then reads supported inputs as Parquet working copies.
- 02The Worker scans the columns a query needs and returns rows with paging metadata, including the requested window and known total. Applications can tell a complete result from a page or preview.
- 03Exports name their scope: All matching rows reruns the query, while Current page and Selected rows use resolved table rows. Compatible outputs can stream; other shapes need materialization.
Engineering Decisions
Resolve dataset identity and field identity separately
An alias such as orders can point to a canonical dataset ID, while a stable query field such as revenue can map to a physical Parquet column such as revenue_cents. The query normalizer resolves each before reading data.
The host catalog must keep aliases, capabilities and physical mappings aligned with its schema. The Worker cannot infer access rights from those declarations.
Expand computed fields into scan dependencies
A requested calculated field may need physical columns that are not themselves visible. Resolve the field against available headers, read its dependencies and materialize the value for consumers or export.
A missing dependency can make a calculation unavailable. Keeping that check at the resolved schema boundary avoids treating a partial row as a valid calculated value.
Return completeness with every window
A final request can be capped, and a later page excludes earlier rows. The window reports offset, returned count, limit, known total and stage so consumers can tell a complete result from a page or preview.
A known total does not make a positive-offset page complete. Local sorting requires a settled, complete result at offset zero that fits the engine row cap; other cases remain Worker-owned.
Key result reuse to the effective query and source revision
Final-result identity includes normalized query parameters and the requested window. Persistent reuse also includes source resource/revision and dataset configuration; unknown source revisions bypass persistence.
Remote byte ranges, OPFS source copies, converted files and query results have different cache keys and validation. Reusing source bytes does not prove a query-result cache hit.
Outcome
Each response gives consuming applications the information to distinguish a complete result from a page and choose an explicit export scope. Dataset authorization stays with the host application.