MCPcopy Create free account
hub / github.com/apache/datafusion / create_tree_recursive

Function create_tree_recursive

datafusion/physical-plan/src/render_tree.rs:192–231  ·  view source on GitHub ↗

Recursively builds the render tree structure. Traverses the execution plan and creates corresponding render nodes while maintaining proper positioning and parent-child relationships. # Arguments `result` - The render tree being constructed `plan` - Current execution plan node being processed `x` - Horizontal position in the tree `y` - Vertical position in the tree # Returns The width of the subt

(
    result: &mut RenderTree,
    plan: &dyn ExecutionPlan,
    x: usize,
    y: usize,
)

Source from the content-addressed store, hash-verified

190/// # Returns
191/// * The width of the subtree rooted at the current node
192fn create_tree_recursive(
193 result: &mut RenderTree,
194 plan: &dyn ExecutionPlan,
195 x: usize,
196 y: usize,
197) -> usize {
198 let display_info = fmt_display(plan).to_string();
199 let mut extra_info = HashMap::new();
200
201 // Parse the key-value pairs from the formatted string.
202 // See DisplayFormatType::TreeRender for details
203 for line in display_info.lines() {
204 if let Some((key, value)) = line.split_once('=') {
205 extra_info.insert(key.to_string(), value.to_string());
206 } else {
207 extra_info.insert(line.to_string(), "".to_string());
208 }
209 }
210
211 let mut node = RenderTreeNode::new(plan.name().to_string(), extra_info);
212
213 let children = plan.children();
214
215 if children.is_empty() {
216 result.set_node(x, y, Arc::new(node));
217 return 1;
218 }
219
220 let mut width = 0;
221 for child in children {
222 let child_x = x + width;
223 let child_y = y + 1;
224 node.add_child_position(child_x, child_y);
225 width += create_tree_recursive(result, child.as_ref(), child_x, child_y);
226 }
227
228 result.set_node(x, y, Arc::new(node));
229
230 width
231}

Callers 1

create_treeMethod · 0.85

Calls 10

fmt_displayFunction · 0.85
newFunction · 0.85
set_nodeMethod · 0.80
add_child_positionMethod · 0.80
to_stringMethod · 0.45
insertMethod · 0.45
nameMethod · 0.45
childrenMethod · 0.45
is_emptyMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…