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
//! Immutable configuration for graph traversal operators.
use linkrs_core::types::expr::Expression;
use linkrs_core::{EdgeDirection, Value};
use crate::parser::ast::pattern::PathSemantic;
/// Immutable config for graph traversal operators.
#[derive(Debug, Clone)]
pub enum GraphSpec {
Expand {
edge_types: Vec<String>,
direction: EdgeDirection,
filter_expr: Option<Expression>,
col_names: Vec<String>,
dst_tag: String,
},
ExpandAll {
edge_types: Vec<String>,
direction: EdgeDirection,
filter_expr: Option<Expression>,
col_names: Vec<String>,
src_vids: Vec<Value>,
step_limit: u32,
step_limits: Option<Vec<u32>>,
/// When true, the expand operator only counts output rows instead of
/// materializing them. Used when the downstream is a simple COUNT(*)
/// aggregate with no GROUP BY or other aggregation functions.
count_only: bool,
/// When true, emit `Value::VertexId` / `Value::EdgeId` instead of
/// full `Value::Vertex(Box)` / `Value::Edge(Box)` in the expand
/// output. Eliminates heap allocation for downstream operators that
/// only need the identifier (e.g. another expand hop, count, join key).
emit_raw_ids: bool,
/// When true (always alongside `emit_raw_ids`), the hop's source
/// column is also emitted as a `Value::VertexId` instead of cloning
/// the full `Value::Vertex(Box)` carried in from upstream.
lightweight_source: bool,
path_semantic: Option<PathSemantic>,
dst_tag: String,
/// Demanded edge properties (`None` means whole edge, empty means
/// topology only). Drives storage projection pushdown.
edge_required_props: Option<Vec<String>>,
/// Demanded destination properties, same encoding as the edge demand.
dst_required_props: Option<Vec<String>>,
/// Single-label closed loop proven by the planner syntactically and
/// re-verified against storage at execution with row fallback.
closed_loop: bool,
/// Rowless mode: skip the row view and emit typed columns only. Valid
/// with empty demands or with bypassable property demands served as
/// flat `{var}.{prop}` columns, always with a closed loop and a
/// column-capable consumer.
skip_rows: bool,
/// Whether seed vertices without any matching edge must still emit a
/// row (edge and destination projected as NULL). Used for OPTIONAL MATCH.
include_empty_paths: bool,
},
Traverse {
edge_types: Vec<String>,
direction: EdgeDirection,
min_depth: u32,
max_depth: u32,
filter_expr: Option<Expression>,
path_semantic: Option<PathSemantic>,
dst_tag: String,
},
BiExpand {
edge_types: Vec<String>,
direction: EdgeDirection,
dst_tag: String,
},
BiTraverse {
edge_types: Vec<String>,
direction: EdgeDirection,
min_depth: u32,
max_depth: u32,
dst_tag: String,
},
}