pub struct Query {
pub parts: Vec<SingleQuery>,
pub union_all: Vec<bool>,
pub next: Option<Box<Query>>,
}Fields§
§parts: Vec<SingleQuery>§union_all: Vec<bool>union_all[i] applies between parts[i] and parts[i+1].
next: Option<Box<Query>>CIP-213 sequential statement composition.
Implementations§
Source§impl Query
impl Query
Sourcepub fn final_stage_projects_rows(&self, verdict: &ConcludingVerdict) -> bool
pub fn final_stage_projects_rows(&self, verdict: &ConcludingVerdict) -> bool
Whether this query’s FINAL stage projects a statement result of
its own under a layer’s ConcludingVerdict — the one shared
body-descent skeleton (ADR-0740): the FINAL-stage cursor (a
NEXT-chained body is judged by its final stage, never its
first), the any-arm fold over the stage’s UNION arms, and the
hand-off of each arm’s concluding clause to the verdict, which
receives this same descent back for the clause’s nested bodies.
The structural invariants are surfaced here, never defaulted
over: a Query invariantly carries at least one part, and a part
at least one clause (validation refuses an empty part before any
fold runs).
Two verdicts ride this one skeleton, and their agreement is the
skeleton’s contract: the naming layer’s
(Query::projects_columns: RETURN-only vocabulary with a
first-branch stand-in) and the executor’s (the planner’s full
clause table with any-branch breadth and its batched-call
ruling). The two answer alike on every valid body — validation
holds every WHEN branch and UNION arm to the same export
shape, so the representative and the any-branch folds cannot
disagree — and a new nested-body arm added to one verdict needs
its twin arm in the other; the agreement test beside the
executor’s verdict pins it.
Sourcepub fn projects_columns(&self) -> bool
pub fn projects_columns(&self) -> bool
Whether this query projects columns: its true final stage (the end of
its NEXT chain, not merely its own part list) ends in a RETURN,
or in a CONDITIONAL / nested CALL { … } that projects. A body
that does not — an update clause, a bare procedure call — leaves a
CALL { … } a unit subquery.
The one IR spelling of the fact: the planner’s subquery-scope fold
and the redundant-OPTIONAL notification detector both read it.
The body-descent structure under it — the FINAL-stage cursor, the
any-arm fold, the concluding-clause hand-off — is the one shared
body-descent skeleton (Query::final_stage_projects_rows,
ADR-0740); this method is the naming layer’s verdict over that
skeleton ([projects_columns_concluding]), where the executor
injects its own (the planner’s full clause table with any-branch
breadth and the batched-call ruling) — the two agree on every
nested-body shape under the validated branch/arm representative
agreement.
Source§impl Query
impl Query
Sourcepub fn final_stage(&self) -> &Query
pub fn final_stage(&self) -> &Query
The end of this query’s NEXT chain — its true terminal stage
(CIP-213), not its own first stage. UNION arms are parts inside
one Query, so the chain walk needs no union guard. The one
IR-level spelling of the cursor the planner’s projection checks and
the executor’s stage handling mirror.
Sourcepub fn is_single_flat_part(&self) -> bool
pub fn is_single_flat_part(&self) -> bool
Whether this query is one flat part with no NEXT stage — no
UNION arms, no stage chain. The one IR spelling of the fact, read
by the subquery fast paths that need a single clause list (the
import-invariant shared execution, the IN TRANSACTIONS batch
pass, ADR-0669), so none re-spells the two conjuncts.