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
//! Common table expression (CTE) name mangling.
//!
//! A recursive-step pattern may scan the working table of an enclosing
//! `WITH RECURSIVE` CTE by naming the CTE as a node label
//! (`MATCH (m:my_cte)-[:KNOWS]->(x)`). Bound CTE labels are mangled with
//! [`CTE_TAG_PREFIX`] so they can never collide with real tag names and so
//! the spec builder can route them to a [`CteScan`](crate::executor::streaming::operators::spec::SourceSpec::CteScan)
//! source instead of storage.
/// Prefix marking a bound tag name as a CTE working-table reference.
///
/// Real tag names cannot contain this prefix in practice (it is not a valid
/// identifier start for schema objects); the spec builder treats any scan
/// tag with this prefix as a CTE scan.
pub const CTE_TAG_PREFIX: &str = "__cte__";
/// Default cap on recursive-CTE fixpoint iterations.
///
/// Mirrors the set-operation nesting guard (`max_depth = 100`) so runaway
/// recursions fail fast instead of looping forever.
pub const DEFAULT_RECURSIVE_CTE_MAX_ITERATIONS: u64 = 100;
/// Mangle a user CTE name into a collision-free internal tag name.
/// Strip [`CTE_TAG_PREFIX`] from a bound tag name, returning the user CTE
/// name when the tag denotes a CTE working-table reference.
/// Whether a bound scan tag denotes a CTE working-table reference.