hawdb_plan_cypher/physical/
plan_node.rs1use super::{PhysicalPlan, PhysicalPlanClass, PhysicalPlanKind, PhysicalPlanNode, PlanChildren};
16
17pub type PhysicalPlanChildren<'a> = PlanChildren<'a, PhysicalPlan>;
18
19impl PhysicalPlan {
20 pub fn kind(&self) -> PhysicalPlanKind {
21 match self {
22 PhysicalPlan::CreateNodeLabel { .. } => PhysicalPlanKind::CreateNodeLabel,
23 PhysicalPlan::CreateRelationshipType { .. } => PhysicalPlanKind::CreateRelationshipType,
24 PhysicalPlan::CreateNodeTable { .. } => PhysicalPlanKind::CreateNodeTable,
25 PhysicalPlan::CreateRelationshipTable { .. } => {
26 PhysicalPlanKind::CreateRelationshipTable
27 }
28 PhysicalPlan::CreateProperty { .. } => PhysicalPlanKind::CreateProperty,
29 PhysicalPlan::AlterTableState { .. } => PhysicalPlanKind::AlterTableState,
30 PhysicalPlan::AlterPropertyState { .. } => PhysicalPlanKind::AlterPropertyState,
31 PhysicalPlan::CreateIndex { .. } => PhysicalPlanKind::CreateIndex,
32 PhysicalPlan::CreateCompositeIndex { .. } => PhysicalPlanKind::CreateCompositeIndex,
33 PhysicalPlan::CreateRangeIndex { .. } => PhysicalPlanKind::CreateRangeIndex,
34 PhysicalPlan::CreateFullTextIndex { .. } => PhysicalPlanKind::CreateFullTextIndex,
35 PhysicalPlan::CreateUniqueConstraint { .. } => PhysicalPlanKind::CreateUniqueConstraint,
36 PhysicalPlan::CreateNodePropertyExistsConstraint { .. } => {
37 PhysicalPlanKind::CreateNodePropertyExistsConstraint
38 }
39 PhysicalPlan::CreateRelationshipUniqueConstraint { .. } => {
40 PhysicalPlanKind::CreateRelationshipUniqueConstraint
41 }
42 PhysicalPlan::CreateRelationshipPropertyExistsConstraint { .. } => {
43 PhysicalPlanKind::CreateRelationshipPropertyExistsConstraint
44 }
45 PhysicalPlan::ProjectGraph { .. } => PhysicalPlanKind::ProjectGraph,
46 PhysicalPlan::GraphAlgorithm { .. } | PhysicalPlan::GraphAlgorithmOutput(_) => {
47 PhysicalPlanKind::GraphAlgorithm
48 }
49 PhysicalPlan::VectorSeedScan { .. } => PhysicalPlanKind::VectorSeedScan,
50 PhysicalPlan::GraphSeedScan { .. } => PhysicalPlanKind::GraphSeedScan,
51 PhysicalPlan::TextSeedScan { .. } => PhysicalPlanKind::TextSeedScan,
52 PhysicalPlan::CreateNode { .. } => PhysicalPlanKind::CreateNode,
53 PhysicalPlan::UnwindMutation { .. } => PhysicalPlanKind::UnwindMutationExec,
54 PhysicalPlan::MergeNode { .. } => PhysicalPlanKind::MergeNode,
55 PhysicalPlan::MergeRelationship { .. } => PhysicalPlanKind::MergeRelationship,
56 PhysicalPlan::MergeMatchedRelationship { .. } => {
57 PhysicalPlanKind::MergeMatchedRelationship
58 }
59 PhysicalPlan::MergeRelationshipFromMatchedRelationship { .. } => {
60 PhysicalPlanKind::MergeRelationshipFromMatchedRelationship
61 }
62 PhysicalPlan::MergeRelationshipToMatchedTarget { .. } => {
63 PhysicalPlanKind::MergeRelationshipToMatchedTarget
64 }
65 PhysicalPlan::MergeRelationshipFromMatchedTarget { .. } => {
66 PhysicalPlanKind::MergeRelationshipFromMatchedTarget
67 }
68 PhysicalPlan::CreateMatchedRelationship { .. } => {
69 PhysicalPlanKind::CreateMatchedRelationship
70 }
71 PhysicalPlan::SetNodeProperty { .. } => PhysicalPlanKind::SetNodeProperty,
72 PhysicalPlan::SetNodeProperties { .. } => PhysicalPlanKind::SetNodeProperties,
73 PhysicalPlan::SetNodePropertiesReturn { .. } => {
74 PhysicalPlanKind::SetNodePropertiesReturn
75 }
76 PhysicalPlan::SetRelationshipProperty { .. } => {
77 PhysicalPlanKind::SetRelationshipProperty
78 }
79 PhysicalPlan::SetRelationshipProperties { .. } => {
80 PhysicalPlanKind::SetRelationshipProperties
81 }
82 PhysicalPlan::DeleteNode { .. } => PhysicalPlanKind::DeleteNode,
83 PhysicalPlan::DeleteRelationship { .. } => PhysicalPlanKind::DeleteRelationship,
84 PhysicalPlan::DeleteRelationshipTargetNodes { .. } => {
85 PhysicalPlanKind::DeleteRelationshipTargetNodes
86 }
87 PhysicalPlan::CreateRelationship { .. } => PhysicalPlanKind::CreateRelationship,
88 PhysicalPlan::GraphMatchExec { .. } => PhysicalPlanKind::GraphMatchExec,
89 PhysicalPlan::EmptyExec => PhysicalPlanKind::EmptyExec,
90 PhysicalPlan::SeqNodeScan { .. } => PhysicalPlanKind::SeqNodeScan,
91 PhysicalPlan::NodeProjectionScanExec { .. } => PhysicalPlanKind::NodeProjectionScanExec,
92 PhysicalPlan::SourceSegmentScan { .. } => PhysicalPlanKind::SourceSegmentScan,
93 PhysicalPlan::HashJoinExec { .. } => PhysicalPlanKind::HashJoinExec,
94 PhysicalPlan::NodeCartesianProductExec { .. } => {
95 PhysicalPlanKind::NodeCartesianProductExec
96 }
97 PhysicalPlan::NodeColumnLookupExec { .. } => PhysicalPlanKind::NodeColumnLookupExec,
98 PhysicalPlan::IndexNodeSeek { .. } => PhysicalPlanKind::IndexNodeSeek,
99 PhysicalPlan::IndexNodeMultiSeek { .. } => PhysicalPlanKind::IndexNodeMultiSeek,
100 PhysicalPlan::IndexNodeUnionSeek { .. } => PhysicalPlanKind::IndexNodeUnionSeek,
101 PhysicalPlan::IndexNodeCompositeSeek { .. } => PhysicalPlanKind::IndexNodeCompositeSeek,
102 PhysicalPlan::IndexNodeCompositeRangeSeek { .. } => {
103 PhysicalPlanKind::IndexNodeCompositeRangeSeek
104 }
105 PhysicalPlan::IndexNodeRangeSeek { .. } => PhysicalPlanKind::IndexNodeRangeSeek,
106 PhysicalPlan::IndexNodeTextSeek { .. } => PhysicalPlanKind::IndexNodeTextSeek,
107 PhysicalPlan::AdjacencyExpandExec { .. } => PhysicalPlanKind::AdjacencyExpandExec,
108 PhysicalPlan::AdjacencyExistsExec { .. } => PhysicalPlanKind::AdjacencyExistsExec,
109 PhysicalPlan::OptionalDegreeExec { .. } => PhysicalPlanKind::OptionalDegreeExec,
110 PhysicalPlan::OptionalRelationshipCountSumExec { .. } => {
111 PhysicalPlanKind::OptionalRelationshipCountSumExec
112 }
113 PhysicalPlan::NodeCountExec { .. } => PhysicalPlanKind::NodeCountExec,
114 PhysicalPlan::RelationshipCountExec { .. } => PhysicalPlanKind::RelationshipCountExec,
115 PhysicalPlan::ThreadRepairStatsExec { .. } => PhysicalPlanKind::ThreadRepairStatsExec,
116 PhysicalPlan::ShortestPathExec { .. } => PhysicalPlanKind::ShortestPathExec,
117 PhysicalPlan::FilterExec { .. } => PhysicalPlanKind::FilterExec,
118 PhysicalPlan::ProjectExec { .. } => PhysicalPlanKind::ProjectExec,
119 PhysicalPlan::AggregateExec { .. } => PhysicalPlanKind::AggregateExec,
120 PhysicalPlan::DistinctExec { .. } => PhysicalPlanKind::DistinctExec,
121 PhysicalPlan::SortExec { .. } => PhysicalPlanKind::SortExec,
122 PhysicalPlan::TopNExec { .. } => PhysicalPlanKind::TopNExec,
123 PhysicalPlan::LimitExec { .. } => PhysicalPlanKind::LimitExec,
124 PhysicalPlan::ScoringRerankExec { .. } => PhysicalPlanKind::ScoringRerankExec,
125 PhysicalPlan::ScoringProgramExec { .. } => PhysicalPlanKind::ScoringProgramExec,
126 PhysicalPlan::HostScoringExec { .. } => PhysicalPlanKind::HostScoringExec,
127 }
128 }
129
130 pub fn class(&self) -> PhysicalPlanClass {
131 self.kind().class()
132 }
133
134 pub fn children(&self) -> PhysicalPlanChildren<'_> {
135 match self {
136 PhysicalPlan::GraphMatchExec { input, .. } => input
137 .as_deref()
138 .map_or(PlanChildren::None, PlanChildren::Unary),
139 PhysicalPlan::NodeCartesianProductExec { left, right }
140 | PhysicalPlan::HashJoinExec { left, right, .. } => PlanChildren::Binary(left, right),
141 PhysicalPlan::NodeColumnLookupExec { input, .. }
142 | PhysicalPlan::AdjacencyExpandExec { input, .. }
143 | PhysicalPlan::AdjacencyExistsExec { input, .. }
144 | PhysicalPlan::OptionalDegreeExec { input, .. }
145 | PhysicalPlan::FilterExec { input, .. }
146 | PhysicalPlan::ProjectExec { input, .. }
147 | PhysicalPlan::AggregateExec { input, .. }
148 | PhysicalPlan::DistinctExec { input }
149 | PhysicalPlan::SortExec { input, .. }
150 | PhysicalPlan::TopNExec { input, .. }
151 | PhysicalPlan::LimitExec { input, .. }
152 | PhysicalPlan::ScoringRerankExec { input, .. }
153 | PhysicalPlan::ScoringProgramExec { input, .. }
154 | PhysicalPlan::HostScoringExec { input, .. } => PlanChildren::Unary(input),
155 PhysicalPlan::CreateNodeLabel { .. }
156 | PhysicalPlan::CreateRelationshipType { .. }
157 | PhysicalPlan::CreateNodeTable { .. }
158 | PhysicalPlan::CreateRelationshipTable { .. }
159 | PhysicalPlan::CreateProperty { .. }
160 | PhysicalPlan::AlterTableState { .. }
161 | PhysicalPlan::AlterPropertyState { .. }
162 | PhysicalPlan::CreateIndex { .. }
163 | PhysicalPlan::CreateCompositeIndex { .. }
164 | PhysicalPlan::CreateRangeIndex { .. }
165 | PhysicalPlan::CreateFullTextIndex { .. }
166 | PhysicalPlan::CreateUniqueConstraint { .. }
167 | PhysicalPlan::CreateNodePropertyExistsConstraint { .. }
168 | PhysicalPlan::CreateRelationshipUniqueConstraint { .. }
169 | PhysicalPlan::CreateRelationshipPropertyExistsConstraint { .. }
170 | PhysicalPlan::ProjectGraph { .. }
171 | PhysicalPlan::GraphAlgorithm { .. }
172 | PhysicalPlan::GraphAlgorithmOutput(_)
173 | PhysicalPlan::VectorSeedScan { .. }
174 | PhysicalPlan::GraphSeedScan { .. }
175 | PhysicalPlan::TextSeedScan { .. }
176 | PhysicalPlan::CreateNode { .. }
177 | PhysicalPlan::UnwindMutation { .. }
178 | PhysicalPlan::MergeNode { .. }
179 | PhysicalPlan::MergeRelationship { .. }
180 | PhysicalPlan::MergeMatchedRelationship { .. }
181 | PhysicalPlan::MergeRelationshipFromMatchedRelationship { .. }
182 | PhysicalPlan::MergeRelationshipToMatchedTarget { .. }
183 | PhysicalPlan::MergeRelationshipFromMatchedTarget { .. }
184 | PhysicalPlan::CreateMatchedRelationship { .. }
185 | PhysicalPlan::SetNodeProperty { .. }
186 | PhysicalPlan::SetNodeProperties { .. }
187 | PhysicalPlan::SetNodePropertiesReturn { .. }
188 | PhysicalPlan::SetRelationshipProperty { .. }
189 | PhysicalPlan::SetRelationshipProperties { .. }
190 | PhysicalPlan::DeleteNode { .. }
191 | PhysicalPlan::DeleteRelationship { .. }
192 | PhysicalPlan::DeleteRelationshipTargetNodes { .. }
193 | PhysicalPlan::CreateRelationship { .. }
194 | PhysicalPlan::EmptyExec
195 | PhysicalPlan::SeqNodeScan { .. }
196 | PhysicalPlan::NodeProjectionScanExec { .. }
197 | PhysicalPlan::SourceSegmentScan { .. }
198 | PhysicalPlan::IndexNodeSeek { .. }
199 | PhysicalPlan::IndexNodeMultiSeek { .. }
200 | PhysicalPlan::IndexNodeUnionSeek { .. }
201 | PhysicalPlan::IndexNodeCompositeSeek { .. }
202 | PhysicalPlan::IndexNodeCompositeRangeSeek { .. }
203 | PhysicalPlan::IndexNodeRangeSeek { .. }
204 | PhysicalPlan::IndexNodeTextSeek { .. }
205 | PhysicalPlan::OptionalRelationshipCountSumExec { .. }
206 | PhysicalPlan::NodeCountExec { .. }
207 | PhysicalPlan::RelationshipCountExec { .. }
208 | PhysicalPlan::ThreadRepairStatsExec { .. }
209 | PhysicalPlan::ShortestPathExec { .. } => PlanChildren::None,
210 }
211 }
212}
213
214impl PhysicalPlanNode for PhysicalPlan {
215 fn kind(&self) -> PhysicalPlanKind {
216 PhysicalPlan::kind(self)
217 }
218
219 fn children(&self) -> PhysicalPlanChildren<'_> {
220 PhysicalPlan::children(self)
221 }
222}