Expand description
How a SELECT COUNT / SUM / AVG request executes — one of the
grouped modes, ranked or having-range — and the grouped modes’ limit
contract, decided from the request’s shape alone.
Versioned dispatcher for the
compute_aggregate_mode_and_check_limit helper.
The helper decides how a SELECT COUNT / SUM / AVG request
against the v1 query surface is executed: as one of the four
(group_by × where) grouped modes, or — from feature version 1 —
as a ranked request when the request orders by the aggregate it
selects (GROUP BY p ORDER BY <the selected aggregate>), or — from
feature version 2 — as a having-range request when a grouped
aggregate carries exactly one having clause. Routing here only
asks which shape the request has; the direction, the bounds, the
limit’s contract and the offset are drive’s call and are made in
detect_ranked_mode / detect_having_mode. It also enforces the
per-mode accepts_limit() contract on the grouped path.
The routing rules it embeds are part of the query contract clients
see on the wire — a change to which (group_by × where_clauses × order_by) shapes are accepted becomes consensus-visible because the
dispatcher runs on every v1 query request. Versioning it lets later
protocol bumps adjust the routing table without breaking older
nodes’ replay of historical traffic, and is what keeps a
mixed-version network in agreement across the ranked-query and
having-range activations: protocol version 13 and earlier select v0,
which has neither path, while protocol version 14 selects v2 and
answers both.
Lives in Drive, under verify as well as server, so drive-abci’s v1
query handler and a client’s check before sending route one request
the same way. It is dispatched via the
DriveAbciDocumentQueryHelperVersions slot in PlatformVersion, the
query version the handler runs at. Each generation refuses with
Drive’s Error::Query (an unknown version with Error::Drive), which
drive-abci reports as QueryError::Query (QueryError::Drive), the
errors its handler answers these refusals with at every protocol
version.
Enums§
- Aggregate
Routing - What the helper decided a request should execute as.
Functions§
- compute_
aggregate_ mode_ and_ check_ limit - Decide how a
SELECT COUNT/SUM/AVGrequest executes.