Skip to content
Snippets Groups Projects
Commit 275bcb7e authored by Denis Smirnov's avatar Denis Smirnov
Browse files

refactoring: add a public method to get the plan top node

parent 69bce0a2
No related branches found
No related tags found
1 merge request!1414sbroad import
......@@ -158,6 +158,14 @@ impl Plan {
}
}
/// Get a top node of the plan tree.
///
/// # Errors
/// - top node is None (i.e. invalid plan)
pub fn get_top(&self) -> Result<usize, QueryPlannerError> {
self.top.ok_or(QueryPlannerError::InvalidPlan)
}
/// Construct a plan from the YAML file.
///
/// # Errors
......
......@@ -99,7 +99,7 @@ fn relational_post() {
let union_id = plan.add_union_all(scan_t1_id, selection_id).unwrap();
plan.set_top(union_id).unwrap();
let top = plan.top.unwrap();
let top = plan.get_top().unwrap();
// Traverse the tree
let mut dft_post = DftPost::new(&top, |node| plan.nodes.rel_iter(node));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment