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
93
94
//! Immutable configuration for unary (one-input) operators.
use linkrs_core::types::expr::Expression;
use linkrs_core::DataType;
/// Immutable config for unary (one-input) operators.
#[derive(Debug, Clone)]
pub enum UnarySpec {
Filter {
predicate: Expression,
/// Expression-level subqueries compiled for this filter;
/// the materializer turns them into a per-operator `SubqueryExecutor`.
subquery_runners: Vec<crate::executor::streaming::subquery::SubqueryRunnerSpec>,
},
Project {
output_expressions: Vec<Expression>,
output_col_names: Vec<String>,
/// Resolved per-column types from the planner (`ProjectNode.column_types`).
/// May be empty for hand-built plans; layouts fall back to untyped slots.
output_col_types: Vec<DataType>,
/// Expression-level subqueries compiled for this project.
subquery_runners: Vec<crate::executor::streaming::subquery::SubqueryRunnerSpec>,
},
Limit {
offset: u32,
limit: u32,
},
Assign {
assignments: Vec<(String, Expression)>,
/// Expression-level subqueries compiled for this assign.
subquery_runners: Vec<crate::executor::streaming::subquery::SubqueryRunnerSpec>,
},
Unwind {
unwind_column: String,
list_expression: Option<Expression>,
},
/// Storage-backed vertex property append.
///
/// Evaluates `entity_expr` per input row to resolve the vertex id, reads
/// the vertex (full or projected) from storage, and appends the property
/// columns to the row. With a non-empty `prop_names` the appended
/// columns are the flat `{entity_var}.{prop}` names; with an empty list
/// the whole `Value::Vertex` is appended under `entity_var`.
AppendVertices {
/// Space the vertex is read from.
space_name: String,
/// Single tag for forced single-label fetch.
tag: String,
/// Binding variable of the appended vertex (flat-column prefix).
entity_var: String,
/// Expression resolved per row to the vertex id.
entity_expr: Expression,
/// Property names to read; empty reads the full vertex.
prop_names: Vec<String>,
},
Sample {
count: u64,
},
Flatten {
group_pos: u32,
/// Alias names of the flattened group snapshotted at rewrite time.
///
/// Traceability metadata only; the executor never validates these
/// names because the schema alias namespace and the runtime
/// column namespace are not identical.
group_columns: Vec<String>,
/// Group count of the child schema at rewrite time, when known.
///
/// The executor rejects a stale `group_pos` (`group_pos` must be
/// below this count) loudly at `open()`. `None` means unknown
/// (hand-built or legacy plan) and skips the check honestly.
expected_groups: Option<u32>,
},
}
impl UnarySpec {
/// Expression-level subquery runner specs of this operator (empty for
/// kinds that do not host subqueries). The materializer instantiates a
/// per-operator `SubqueryExecutor` from these.
pub fn subquery_runners(&self) -> &[crate::executor::streaming::subquery::SubqueryRunnerSpec] {
match self {
Self::Filter {
subquery_runners, ..
}
| Self::Project {
subquery_runners, ..
}
| Self::Assign {
subquery_runners, ..
} => subquery_runners,
_ => &[],
}
}
}