Format a single plan node with tree structure
(
&self,
node: &PhysicalNode,
output: &mut String,
depth: usize,
is_last: bool,
)
| 177 | |
| 178 | /// Format a single plan node with tree structure |
| 179 | fn format_plan_node( |
| 180 | &self, |
| 181 | node: &PhysicalNode, |
| 182 | output: &mut String, |
| 183 | depth: usize, |
| 184 | is_last: bool, |
| 185 | ) { |
| 186 | // Tree connector |
| 187 | let prefix = if depth == 0 { |
| 188 | "".to_string() |
| 189 | } else { |
| 190 | let mut p = String::new(); |
| 191 | for _i in 0..depth - 1 { |
| 192 | p.push_str("│ "); |
| 193 | } |
| 194 | if is_last { |
| 195 | p.push_str("└── "); |
| 196 | } else { |
| 197 | p.push_str("├── "); |
| 198 | } |
| 199 | p |
| 200 | }; |
| 201 | |
| 202 | match node { |
| 203 | PhysicalNode::NodeSeqScan { |
| 204 | variable, |
| 205 | labels, |
| 206 | estimated_rows, |
| 207 | estimated_cost, |
| 208 | .. |
| 209 | } => { |
| 210 | output.push_str(&format!( |
| 211 | "{}NodeScan[{}:{}] → {} rows, cost: {:.1}\n", |
| 212 | prefix, |
| 213 | variable, |
| 214 | labels.join("|"), |
| 215 | estimated_rows, |
| 216 | estimated_cost |
| 217 | )); |
| 218 | output.push_str(&format!( |
| 219 | "{} Variables: {}\n", |
| 220 | " ".repeat(prefix.len()), |
| 221 | variable |
| 222 | )); |
| 223 | if !labels.is_empty() { |
| 224 | output.push_str(&format!( |
| 225 | "{} Labels: {}\n", |
| 226 | " ".repeat(prefix.len()), |
| 227 | labels.join(", ") |
| 228 | )); |
| 229 | } |
| 230 | } |
| 231 | PhysicalNode::NodeIndexScan { |
| 232 | variable, |
| 233 | labels, |
| 234 | estimated_rows, |
| 235 | estimated_cost, |
| 236 | .. |
no test coverage detected