38 lines
1.9 KiB
Markdown
Raw Normal View History

2026-06-11 15:58:24 +02:00
## Query Plan Viewer
2026-06-11 15:58:24 +02:00
A static HTML viewer for `plan-runner` JSON files (the fixtures).
It renders the plan DAG, the input facts, and the relation computed at every plan node, so a fixture can be inspected without reading raw JSON.
2026-06-11 15:58:24 +02:00
### Usag
Open [`index.html`](index.html) in a browser, then drop a fixture from `crates/plan-runner/fixtures/` onto the page or pick one with the file input.
When the repository is served over HTTP, a fixture can also be loaded through a query parameter:
```sh
2026-06-11 15:58:24 +02:00
make viewer # Or `VIEWER_PORT=9000 make viewer`
# Then open:
# http://localhost:8000/tools/plan-viewer/index.html?fixture=../../crates/plan-runner/fixtures/two_atom_join.json
```
## What It Shows
- **Plan DAG**: one box per plan node, laid out left to right by join depth, with `L` and `R` labels on join inputs and the root node marked.
Each box shows the node's output columns and row count.
- **Selected Node**: a plain-language description of the operator, its output columns, and the full relation computed at that node.
Wildcard columns (names starting with an underscore) are dimmed.
- **Result Bindings**: the root relation projected to the fixture's `expected_bindings` columns, with a per-row check against the oracle and a list of any expected rows the plan did not produce.
- **Input Facts**: one table per relation in the fixture's schema.
The header badge reports whether the evaluated bindings match the fixture's `expected_bindings` as a multiset, mirroring `plan_runner::verify`.
2026-06-11 15:58:24 +02:00
### Scope
The viewer re-implements the scan, semijoin, and natural join semantics of `crates/query-ops` and the execution order of `crates/plan-runner` in JavaScript, for display only.
The Rust crates and their tests remain the correctness oracle; if the two ever disagree, the Rust behavior wins and the viewer has a bug.
Unsupported cases:
- plan node actions other than `scan` and `join`
- fixtures without a `query` and `schema` block