Skip to content
Snippets Groups Projects
Verified Commit 75a271c6 authored by Denis Smirnov's avatar Denis Smirnov
Browse files

refactoring: variable names in subtree iterator test

parent 599e4ae3
No related branches found
No related tags found
1 merge request!1414sbroad import
...@@ -208,7 +208,8 @@ fn subtree_dfs_post() { ...@@ -208,7 +208,8 @@ fn subtree_dfs_post() {
// select c from t1 where a = 1 // select c from t1 where a = 1
// //
// ir tree: // ir tree:
// - projection: (c) // - projection
// - (c)
// - selection // - selection
// - scan t1 // - scan t1
// - filter // - filter
...@@ -233,16 +234,16 @@ fn subtree_dfs_post() { ...@@ -233,16 +234,16 @@ fn subtree_dfs_post() {
let a_ref = plan.nodes.next_id(); let a_ref = plan.nodes.next_id();
let a = plan.add_row_from_child(scan_t1_id, &["a"]).unwrap(); let a = plan.add_row_from_child(scan_t1_id, &["a"]).unwrap();
let const1 = plan.add_const(Value::from(1_i64)); let const1 = plan.add_const(Value::from(1_i64));
let in_op = plan.nodes.add_bool(a, Bool::Eq, const1).unwrap(); let eq_op = plan.nodes.add_bool(a, Bool::Eq, const1).unwrap();
let selection_t1_id = plan.add_select(&[scan_t1_id], in_op).unwrap(); let selection_t1_id = plan.add_select(&[scan_t1_id], eq_op).unwrap();
let proj_id = plan.add_proj(selection_t1_id, &["c"]).unwrap(); let proj_id = plan.add_proj(selection_t1_id, &["c"]).unwrap();
plan.set_top(proj_id).unwrap(); plan.set_top(proj_id).unwrap();
let top = plan.get_top().unwrap(); let top = plan.get_top().unwrap();
let row_id = plan.get_relation_node(proj_id).unwrap().output(); let proj_row_id = plan.get_relation_node(proj_id).unwrap().output();
let row_children = plan let row_children = plan
.get_expression_node(row_id) .get_expression_node(proj_row_id)
.unwrap() .unwrap()
.clone_row_list() .clone_row_list()
.unwrap(); .unwrap();
...@@ -255,15 +256,15 @@ fn subtree_dfs_post() { ...@@ -255,15 +256,15 @@ fn subtree_dfs_post() {
}; };
// Traverse relational nodes in the plan tree // Traverse relational nodes in the plan tree
let mut dft_post = DftPost::new(&top, |node| plan.nodes.subtree_iter(node)); let mut dft_post = DftPost::new(&top, |node| plan.subtree_iter(node));
assert_eq!(dft_post.next(), Some((3, c_ref_id))); assert_eq!(dft_post.next(), Some((3, c_ref_id)));
assert_eq!(dft_post.next(), Some((2, alias_id))); assert_eq!(dft_post.next(), Some((2, alias_id)));
assert_eq!(dft_post.next(), Some((1, &row_id))); assert_eq!(dft_post.next(), Some((1, &proj_row_id)));
assert_eq!(dft_post.next(), Some((2, &scan_t1_id))); assert_eq!(dft_post.next(), Some((2, &scan_t1_id)));
assert_eq!(dft_post.next(), Some((4, &a_ref))); assert_eq!(dft_post.next(), Some((4, &a_ref)));
assert_eq!(dft_post.next(), Some((3, &a))); assert_eq!(dft_post.next(), Some((3, &a)));
assert_eq!(dft_post.next(), Some((3, &const1))); assert_eq!(dft_post.next(), Some((3, &const1)));
assert_eq!(dft_post.next(), Some((2, &in_op))); assert_eq!(dft_post.next(), Some((2, &eq_op)));
assert_eq!(dft_post.next(), Some((1, &selection_t1_id))); assert_eq!(dft_post.next(), Some((1, &selection_t1_id)));
assert_eq!(dft_post.next(), Some((0, &proj_id))); assert_eq!(dft_post.next(), Some((0, &proj_id)));
assert_eq!(dft_post.next(), None); assert_eq!(dft_post.next(), None);
......
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