1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! The top-K growth policy both SEARCH scan shapes follow: when the
//! growth loop is complete, and how the next round's window widens.
//!
//! Whether a wider fetched window can reach a *new* candidate — the
//! growth precondition — is not policy but a fact of each scan shape,
//! stated at its call site: both paths always grow (a candidate — the
//! binding a row names, or a pattern row's own binding — may sit
//! arbitrarily deep in the ranking, so a deeper fetched entry is always
//! a new possible survivor); termination is the index's (`may_widen`),
//! never the shape's.
//!
//! The SKIP/LIMIT window pages over entities the whole MATCH statement
//! keeps (the pattern, the outer WHERE, a pre-bound binding), so both
//! loops widen while enough survivors have not been seen — for every
//! pattern shape alike (ADR-0678).
use ;
use SearchClause;
use EntityKind;
use ;
use crateRow;
/// What a scan shape's `take` decides after seeing one round's new
/// candidates: the round's own verdict on completion, so the loop never
/// re-derives the rule the shape already owns.
pub
/// The fetch-and-widen skeleton both un-deferred row sources share: fetch
/// the ranked window, check the binding's kind, hand the round's *new*
/// candidates to `take`, and widen until `take` reports [`Round::Done`] or
/// the index cannot widen. A window that can keep nothing (LIMIT 0) ends
/// before any fetch. The scans always grow — the binding is seeded per
/// candidate, so a wider window can reach candidates the current one
/// cannot — and termination is the index's (`may_widen`).
///
/// Every wider round returns an identical superset prefix of the same
/// ranking (the index's contract), so the candidates an earlier round
/// already handed over are the first `processed` entries and only the
/// tail is fresh.
pub ,
)
/// The top-K completion test, stated once for both paths: the loop ends
/// when the index cannot widen or enough candidates have a surviving
/// row. Both scans always grow (a candidate may sit arbitrarily deep in
/// the ranking), so no caller states a grows guard beside the test.
pub
/// The next growth round's extra-candidate budget: geometric doubling
/// from `base`, clamped to at least 1 — the guarantee is this helper's
/// own, so no caller compensates with its own floor — so the window
/// grows toward the index's depth in logarithmic rounds.
pub