From fe6ce5539b173667756ea31eadb47ce15f73ecaa Mon Sep 17 00:00:00 2001
From: Denis Smirnov <sd@picodata.io>
Date: Fri, 17 Dec 2021 16:03:26 +0700
Subject: [PATCH] refactoring: move plan node into a separate structure

We need this refactoring to move all node plan methodes to the new
Nodes structure. Otherwise we have to put a mutable lock for the
whole plan structure rather then on the nodes list. It makes
porblems with API refactoring otherwise.
---
 src/ir.rs                                     |  28 +-
 src/ir/distribution.rs                        |   4 +
 src/ir/distribution/tests.rs                  |   2 +-
 src/ir/expression.rs                          |  12 +-
 src/ir/operator.rs                            |   8 +-
 src/ir/operator/tests.rs                      |   8 +-
 src/ir/traversal.rs                           |  12 +-
 .../ir/expression/shrink_dist_key_1.yaml      | 163 +++++------
 .../ir/expression/shrink_dist_key_2.yaml      | 141 +++++-----
 .../ir/expression/shuffle_dist_key.yaml       | 163 +++++------
 .../expression/union_fallback_to_random.yaml  | 187 ++++++-------
 .../ir/expression/union_preserve_dist.yaml    | 187 ++++++-------
 .../ir/operator/output_aliases.yaml           |  59 ++--
 .../operator/output_aliases_duplicates.yaml   |  59 ++--
 .../ir/operator/output_aliases_oor.yaml       |  41 +--
 .../output_aliases_unsupported_type.yaml      |  51 ++--
 tests/artifactory/ir/operator/projection.yaml | 111 ++++----
 tests/artifactory/ir/operator/scan_rel.yaml   | 107 +++----
 tests/artifactory/ir/operator/selection.yaml  | 261 +++++++++---------
 tests/artifactory/ir/operator/sub_query.yaml  | 133 ++++-----
 tests/artifactory/ir/plan_no_top.yaml         |  39 +--
 tests/artifactory/ir/plan_oor_top.yaml        |  39 +--
 22 files changed, 920 insertions(+), 895 deletions(-)

diff --git a/src/ir.rs b/src/ir.rs
index e36c1a5514..5deb3b7552 100644
--- a/src/ir.rs
+++ b/src/ir.rs
@@ -34,6 +34,17 @@ pub enum Node {
     Relational(Relational),
 }
 
+/// Plan node arena.
+///
+/// We don't want to mess with the borrow checker and RefCell/Rc,
+/// so all nodes are stored in the single arena ("nodes" array).
+/// The positions in the array act like pointers, so it is possible
+/// only to add nodes to the plan, but never remove them.
+#[derive(Serialize, Deserialize, PartialEq, Debug)]
+pub struct Nodes {
+    arena: Vec<Node>, 
+}
+
 /// Plan node "allocator".
 ///
 /// Inserts an element to the array and returns its position,
@@ -46,11 +57,6 @@ pub fn vec_alloc<T>(v: &mut Vec<T>, item: T) -> usize {
 
 /// Logical plan tree structure.
 ///
-/// We don't want to mess with the borrow checker and RefCell/Rc,
-/// so all nodes are stored in the single arena ("nodes" array).
-/// The positions in the array act like pointers, so it is possible
-/// only to add nodes to the plan, but never remove them.
-///
 /// Relations are stored in a hash-map, with a table name acting as a
 /// key to guarantee its uniqueness across the plan. The map is marked
 /// optional because plans without relations do exist (`select 1`).
@@ -67,7 +73,7 @@ pub fn vec_alloc<T>(v: &mut Vec<T>, item: T) -> usize {
 /// be added last. The plan without a top should be treated as invalid.
 #[derive(Serialize, Deserialize, PartialEq, Debug)]
 pub struct Plan {
-    nodes: Vec<Node>,
+    nodes: Nodes,
     relations: Option<HashMap<String, Table>>,
     slices: Option<Vec<Vec<usize>>>,
     top: Option<usize>,
@@ -99,7 +105,7 @@ impl Plan {
         match self.top {
             None => return Err(QueryPlannerError::InvalidPlan),
             Some(top) => {
-                if self.nodes.get(top).is_none() {
+                if self.nodes.arena.get(top).is_none() {
                     return Err(QueryPlannerError::ValueOutOfRange);
                 }
             }
@@ -114,7 +120,7 @@ impl Plan {
     #[must_use]
     pub fn empty() -> Self {
         Plan {
-            nodes: Vec::new(),
+            nodes: Nodes { arena: Vec::new() },
             relations: None,
             slices: None,
             top: None,
@@ -127,7 +133,7 @@ impl Plan {
     /// Returns `QueryPlannerError` when the node with requested index
     /// doesn't exist.
     pub fn get_node(&self, pos: usize) -> Result<&Node, QueryPlannerError> {
-        match self.nodes.get(pos) {
+        match self.nodes.arena.get(pos) {
             None => Err(QueryPlannerError::ValueOutOfRange),
             Some(node) => Ok(node),
         }
@@ -149,14 +155,14 @@ impl Plan {
     /// Returns the next node position
     #[must_use]
     pub fn next_node_id(&self) -> usize {
-        self.nodes.len()
+        self.nodes.arena.len()
     }
 
     /// Build {logical id: position} map for relational nodes
     #[must_use]
     pub fn relational_id_map(&self) -> HashMap<usize, usize> {
         let mut map: HashMap<usize, usize> = HashMap::new();
-        for (pos, node) in self.nodes.iter().enumerate() {
+        for (pos, node) in self.nodes.arena.iter().enumerate() {
             if let Node::Relational(relational) = node {
                 map.insert(relational.logical_id(), pos);
             }
diff --git a/src/ir/distribution.rs b/src/ir/distribution.rs
index b103c44b70..09da8f8a24 100644
--- a/src/ir/distribution.rs
+++ b/src/ir/distribution.rs
@@ -163,6 +163,7 @@ impl Plan {
                     ..
                 }) = self
                     .nodes
+                    .arena
                     .get_mut(row_node)
                     .ok_or(QueryPlannerError::InvalidRow)?
                 {
@@ -254,6 +255,7 @@ impl Plan {
                             ..
                         }) = self
                             .nodes
+                            .arena
                             .get_mut(row_node)
                             .ok_or(QueryPlannerError::InvalidRow)?
                         {
@@ -267,6 +269,7 @@ impl Plan {
                         ..
                     }) = self
                         .nodes
+                        .arena
                         .get_mut(row_node)
                         .ok_or(QueryPlannerError::InvalidRow)?
                     {
@@ -308,6 +311,7 @@ impl Plan {
                 ..
             }) = self
                 .nodes
+                .arena
                 .get_mut(row_node)
                 .ok_or(QueryPlannerError::InvalidRow)?
             {
diff --git a/src/ir/distribution/tests.rs b/src/ir/distribution/tests.rs
index dccf46a8fb..4ca9939314 100644
--- a/src/ir/distribution/tests.rs
+++ b/src/ir/distribution/tests.rs
@@ -25,7 +25,7 @@ fn proj_preserve_dist_key() {
     let scan_id = plan.add_scan("t").unwrap();
 
     let proj = Relational::new_proj(&mut plan, scan_id, &["a", "b"]).unwrap();
-    let proj_id = vec_alloc(&mut plan.nodes, Node::Relational(proj));
+    let proj_id = vec_alloc(&mut plan.nodes.arena, Node::Relational(proj));
 
     plan.top = Some(proj_id);
 
diff --git a/src/ir/expression.rs b/src/ir/expression.rs
index f2e1f670e8..999cb9f362 100644
--- a/src/ir/expression.rs
+++ b/src/ir/expression.rs
@@ -209,18 +209,18 @@ impl Plan {
                 let new_targets: Vec<usize> = targets.iter().copied().collect();
                 // Create new references and aliases. Save them to the plan nodes arena.
                 let r_id = vec_alloc(
-                    &mut self.nodes,
+                    &mut self.nodes.arena,
                     Node::Expression(Expression::new_ref(rel_node_id, Some(new_targets), pos)),
                 );
                 let a_id = vec_alloc(
-                    &mut self.nodes,
+                    &mut self.nodes.arena,
                     Node::Expression(Expression::new_alias(&name, r_id)),
                 );
                 aliases.push(a_id);
             }
 
             let row_node = vec_alloc(
-                &mut self.nodes,
+                &mut self.nodes.arena,
                 Node::Expression(Expression::new_row(aliases, None)),
             );
             return Ok(row_node);
@@ -239,11 +239,11 @@ impl Plan {
                 let new_targets: Vec<usize> = targets.iter().copied().collect();
                 // Create new references and aliases. Save them to the plan nodes arena.
                 let r_id = vec_alloc(
-                    &mut self.nodes,
+                    &mut self.nodes.arena,
                     Node::Expression(Expression::new_ref(rel_node_id, Some(new_targets), *pos)),
                 );
                 let a_id = vec_alloc(
-                    &mut self.nodes,
+                    &mut self.nodes.arena,
                     Node::Expression(Expression::new_alias(col, r_id)),
                 );
                 aliases.push(a_id);
@@ -253,7 +253,7 @@ impl Plan {
 
         if all_found {
             let row_node = vec_alloc(
-                &mut self.nodes,
+                &mut self.nodes.arena,
                 Node::Expression(Expression::new_row(aliases, None)),
             );
             return Ok(row_node);
diff --git a/src/ir/operator.rs b/src/ir/operator.rs
index f6591999d3..3c65c175ea 100644
--- a/src/ir/operator.rs
+++ b/src/ir/operator.rs
@@ -127,12 +127,12 @@ impl Relational {
     ) -> Result<HashMap<String, usize>, QueryPlannerError> {
         let mut map: HashMap<String, usize> = HashMap::new();
 
-        if let Some(Node::Expression(Expression::Row { list, .. })) = plan.nodes.get(self.output())
+        if let Some(Node::Expression(Expression::Row { list, .. })) = plan.nodes.arena.get(self.output())
         {
             let valid = list.iter().enumerate().all(|(pos, item)| {
                 // Check that expressions in the row list are all aliases
                 if let Some(Node::Expression(Expression::Alias { ref name, .. })) =
-                    plan.nodes.get(*item)
+                    plan.nodes.arena.get(*item)
                 {
                     // Populate the map and check duplicate absence
                     if map.insert(String::from(name), pos).is_none() {
@@ -318,7 +318,7 @@ impl Plan {
     /// Returns `QueryPlannerError` when when relation is invalid.
     pub fn add_scan(&mut self, table: &str) -> Result<usize, QueryPlannerError> {
         let logical_id = self.next_node_id();
-        let nodes = &mut self.nodes;
+        let nodes = &mut self.nodes.arena;
 
         if let Some(relations) = &self.relations {
             if let Some(rel) = relations.get(table) {
@@ -346,7 +346,7 @@ impl Plan {
                             relation: String::from(table),
                         };
 
-                        return Ok(vec_alloc(&mut self.nodes, Node::Relational(scan)));
+                        return Ok(vec_alloc(&mut self.nodes.arena, Node::Relational(scan)));
                     }
                     //TODO: implement virtual tables as well
                     _ => return Err(QueryPlannerError::InvalidRelation),
diff --git a/src/ir/operator/tests.rs b/src/ir/operator/tests.rs
index 7ddafc9141..0d7bb3a815 100644
--- a/src/ir/operator/tests.rs
+++ b/src/ir/operator/tests.rs
@@ -151,19 +151,19 @@ fn selection() {
     let scan_id = plan.add_scan("t").unwrap();
 
     let ref_a_id = vec_alloc(
-        &mut plan.nodes,
+        &mut plan.nodes.arena,
         Node::Expression(Expression::new_ref(scan_id + 1, Some(vec![0]), 0)),
     );
     let a_id = vec_alloc(
-        &mut plan.nodes,
+        &mut plan.nodes.arena,
         Node::Expression(Expression::new_alias("a", ref_a_id)),
     );
     let const_id = vec_alloc(
-        &mut plan.nodes,
+        &mut plan.nodes.arena,
         Node::Expression(Expression::new_const(Value::number_from_str("10").unwrap())),
     );
     let gt_id = vec_alloc(
-        &mut plan.nodes,
+        &mut plan.nodes.arena,
         Node::Expression(Expression::new_bool(a_id, Bool::Gt, const_id)),
     );
 
diff --git a/src/ir/traversal.rs b/src/ir/traversal.rs
index c201fba5ab..9cdf8360b9 100644
--- a/src/ir/traversal.rs
+++ b/src/ir/traversal.rs
@@ -38,7 +38,7 @@ impl<'n> Iterator for BranchIterator<'n> {
             let current_step = *self.step.borrow();
             let child = children.get(current_step);
             child.and_then(|pos| {
-                let node = self.plan.nodes.get(*pos);
+                let node = self.plan.nodes.arena.get(*pos);
                 *self.step.borrow_mut() += 1;
                 node
             })
@@ -50,7 +50,7 @@ impl<'n> Iterator for BranchIterator<'n> {
                     let current_step = *self.step.borrow();
                     if current_step == 0 {
                         *self.step.borrow_mut() += 1;
-                        return self.plan.nodes.get(*child);
+                        return self.plan.nodes.arena.get(*child);
                     }
                     None
                 }
@@ -58,10 +58,10 @@ impl<'n> Iterator for BranchIterator<'n> {
                     let current_step = *self.step.borrow();
                     if current_step == 0 {
                         *self.step.borrow_mut() += 1;
-                        return self.plan.nodes.get(*left);
+                        return self.plan.nodes.arena.get(*left);
                     } else if current_step == 1 {
                         *self.step.borrow_mut() += 1;
-                        return self.plan.nodes.get(*right);
+                        return self.plan.nodes.arena.get(*right);
                     }
                     None
                 }
@@ -70,7 +70,7 @@ impl<'n> Iterator for BranchIterator<'n> {
                     let current_step = *self.step.borrow();
                     if let Some(node) = list.get(current_step) {
                         *self.step.borrow_mut() += 1;
-                        return self.plan.nodes.get(*node);
+                        return self.plan.nodes.arena.get(*node);
                     }
                     None
                 }
@@ -86,7 +86,7 @@ impl<'n> Iterator for BranchIterator<'n> {
                         return get_next_child(children);
                     } else if current_step == 2 {
                         *self.step.borrow_mut() += 1;
-                        return self.plan.nodes.get(*condition);
+                        return self.plan.nodes.arena.get(*condition);
                     }
                     None
                 }
diff --git a/tests/artifactory/ir/expression/shrink_dist_key_1.yaml b/tests/artifactory/ir/expression/shrink_dist_key_1.yaml
index 84b859355b..4b665ba9ba 100644
--- a/tests/artifactory/ir/expression/shrink_dist_key_1.yaml
+++ b/tests/artifactory/ir/expression/shrink_dist_key_1.yaml
@@ -1,86 +1,87 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 0
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Reference:
-        targets: ~
-        position: 2
-        parent: 0
-  - Expression:
-      Alias:
-        name: c
-        child: 4
-  - Expression:
-      Reference:
-        targets: ~
-        position: 3
-        parent: 0
-  - Expression:
-      Alias:
-        name: d
-        child: 6
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-          - 5
-          - 7
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 8
-        id: 0
-        relation: t
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        position: 2
-        parent: 10
-  - Expression:
-      Alias:
-        name: c
-        child: 10
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        position: 0
-        parent: 10
-  - Expression:
-      Alias:
-        name: a
-        child: 12
-  - Expression:
-      Row:
-        list:
-          - 11
-          - 13
-        distribution: ~
-  - Relational:
-      Projection:
-        children:
-          - 9
-        id: 10
-        output: 14
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 0
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Reference:
+          targets: ~
+          position: 2
+          parent: 0
+    - Expression:
+        Alias:
+          name: c
+          child: 4
+    - Expression:
+        Reference:
+          targets: ~
+          position: 3
+          parent: 0
+    - Expression:
+        Alias:
+          name: d
+          child: 6
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+            - 5
+            - 7
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 8
+          id: 0
+          relation: t
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          position: 2
+          parent: 10
+    - Expression:
+        Alias:
+          name: c
+          child: 10
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          position: 0
+          parent: 10
+    - Expression:
+        Alias:
+          name: a
+          child: 12
+    - Expression:
+        Row:
+          list:
+            - 11
+            - 13
+          distribution: ~
+    - Relational:
+        Projection:
+          children:
+            - 9
+          id: 10
+          output: 14
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/expression/shrink_dist_key_2.yaml b/tests/artifactory/ir/expression/shrink_dist_key_2.yaml
index 902ca79ffe..ba5fa827c5 100644
--- a/tests/artifactory/ir/expression/shrink_dist_key_2.yaml
+++ b/tests/artifactory/ir/expression/shrink_dist_key_2.yaml
@@ -1,75 +1,76 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 0
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Reference:
-        targets: ~
-        position: 2
-        parent: 0
-  - Expression:
-      Alias:
-        name: c
-        child: 4
-  - Expression:
-      Reference:
-        targets: ~
-        position: 3
-        parent: 0
-  - Expression:
-      Alias:
-        name: d
-        child: 6
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-          - 5
-          - 7
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 8
-        id: 0
-        relation: t
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        position: 0
-        parent: 10
-  - Expression:
-      Alias:
-        name: a
-        child: 10
-  - Expression:
-      Row:
-        list:
-          - 11
-        distribution: ~
-  - Relational:
-      Projection:
-        children:
-          - 9
-        id: 10
-        output: 12
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 0
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Reference:
+          targets: ~
+          position: 2
+          parent: 0
+    - Expression:
+        Alias:
+          name: c
+          child: 4
+    - Expression:
+        Reference:
+          targets: ~
+          position: 3
+          parent: 0
+    - Expression:
+        Alias:
+          name: d
+          child: 6
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+            - 5
+            - 7
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 8
+          id: 0
+          relation: t
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          position: 0
+          parent: 10
+    - Expression:
+        Alias:
+          name: a
+          child: 10
+    - Expression:
+        Row:
+          list:
+            - 11
+          distribution: ~
+    - Relational:
+        Projection:
+          children:
+            - 9
+          id: 10
+          output: 12
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/expression/shuffle_dist_key.yaml b/tests/artifactory/ir/expression/shuffle_dist_key.yaml
index 8acc09bf0d..2938e442bf 100644
--- a/tests/artifactory/ir/expression/shuffle_dist_key.yaml
+++ b/tests/artifactory/ir/expression/shuffle_dist_key.yaml
@@ -1,86 +1,87 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 0
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Reference:
-        targets: ~
-        position: 2
-        parent: 0
-  - Expression:
-      Alias:
-        name: c
-        child: 4
-  - Expression:
-      Reference:
-        targets: ~
-        position: 3
-        parent: 0
-  - Expression:
-      Alias:
-        name: d
-        child: 6
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-          - 5
-          - 7
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 8
-        id: 0
-        relation: t
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        position: 1
-        parent: 10
-  - Expression:
-      Alias:
-        name: b
-        child: 10
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        position: 0
-        parent: 10
-  - Expression:
-      Alias:
-        name: a
-        child: 12
-  - Expression:
-      Row:
-        list:
-          - 11
-          - 13
-        distribution: ~
-  - Relational:
-      Projection:
-        children:
-          - 9
-        id: 10
-        output: 14
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 0
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Reference:
+          targets: ~
+          position: 2
+          parent: 0
+    - Expression:
+        Alias:
+          name: c
+          child: 4
+    - Expression:
+        Reference:
+          targets: ~
+          position: 3
+          parent: 0
+    - Expression:
+        Alias:
+          name: d
+          child: 6
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+            - 5
+            - 7
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 8
+          id: 0
+          relation: t
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          position: 1
+          parent: 10
+    - Expression:
+        Alias:
+          name: b
+          child: 10
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          position: 0
+          parent: 10
+    - Expression:
+        Alias:
+          name: a
+          child: 12
+    - Expression:
+        Row:
+          list:
+            - 11
+            - 13
+          distribution: ~
+    - Relational:
+        Projection:
+          children:
+            - 9
+          id: 10
+          output: 14
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/expression/union_fallback_to_random.yaml b/tests/artifactory/ir/expression/union_fallback_to_random.yaml
index e2d9e1125a..ffe472a31e 100644
--- a/tests/artifactory/ir/expression/union_fallback_to_random.yaml
+++ b/tests/artifactory/ir/expression/union_fallback_to_random.yaml
@@ -1,98 +1,99 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 0
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 4
-        id: 0
-        relation: t1
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 6
-  - Expression:
-      Alias:
-        name: a
-        child: 6
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 6
-  - Expression:
-      Alias:
-        name: b
-        child: 8
-  - Expression:
-      Row:
-        list:
-          - 7
-          - 9
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 10
-        id: 6
-        relation: t2
-  - Expression:
-      Reference:
-        targets:
-          - 0
-          - 1
-        position: 0
-        parent: 12
-  - Expression:
-      Alias:
-        name: a
-        child: 12
-  - Expression:
-      Reference:
-        targets:
-          - 0
-          - 1
-        position: 1
-        parent: 12
-  - Expression:
-      Alias:
-        name: b
-        child: 14
-  - Expression:
-      Row:
-        list:
-          - 13
-          - 15
-        distribution: ~
-  - Relational:
-      UnionAll:
-        children:
-          - 5
-          - 11
-        id: 12
-        output: 16
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 0
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 4
+          id: 0
+          relation: t1
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 6
+    - Expression:
+        Alias:
+          name: a
+          child: 6
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 6
+    - Expression:
+        Alias:
+          name: b
+          child: 8
+    - Expression:
+        Row:
+          list:
+            - 7
+            - 9
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 10
+          id: 6
+          relation: t2
+    - Expression:
+        Reference:
+          targets:
+            - 0
+            - 1
+          position: 0
+          parent: 12
+    - Expression:
+        Alias:
+          name: a
+          child: 12
+    - Expression:
+        Reference:
+          targets:
+            - 0
+            - 1
+          position: 1
+          parent: 12
+    - Expression:
+        Alias:
+          name: b
+          child: 14
+    - Expression:
+        Row:
+          list:
+            - 13
+            - 15
+          distribution: ~
+    - Relational:
+        UnionAll:
+          children:
+            - 5
+            - 11
+          id: 12
+          output: 16
 relations:
   t1:
     Segment:
diff --git a/tests/artifactory/ir/expression/union_preserve_dist.yaml b/tests/artifactory/ir/expression/union_preserve_dist.yaml
index ca72f859f5..1eedca3537 100644
--- a/tests/artifactory/ir/expression/union_preserve_dist.yaml
+++ b/tests/artifactory/ir/expression/union_preserve_dist.yaml
@@ -1,98 +1,99 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 0
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 4
-        id: 0
-        relation: t1
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 6
-  - Expression:
-      Alias:
-        name: a
-        child: 6
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 6
-  - Expression:
-      Alias:
-        name: b
-        child: 8
-  - Expression:
-      Row:
-        list:
-          - 7
-          - 9
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 10
-        id: 6
-        relation: t2
-  - Expression:
-      Reference:
-        targets:
-          - 0
-          - 1
-        position: 0
-        parent: 12
-  - Expression:
-      Alias:
-        name: a
-        child: 12
-  - Expression:
-      Reference:
-        targets:
-          - 0
-          - 1
-        position: 1
-        parent: 12
-  - Expression:
-      Alias:
-        name: b
-        child: 14
-  - Expression:
-      Row:
-        list:
-          - 13
-          - 15
-        distribution: ~
-  - Relational:
-      UnionAll:
-        children:
-          - 5
-          - 11
-        id: 12
-        output: 16
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 0
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 4
+          id: 0
+          relation: t1
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 6
+    - Expression:
+        Alias:
+          name: a
+          child: 6
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 6
+    - Expression:
+        Alias:
+          name: b
+          child: 8
+    - Expression:
+        Row:
+          list:
+            - 7
+            - 9
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 10
+          id: 6
+          relation: t2
+    - Expression:
+        Reference:
+          targets:
+            - 0
+            - 1
+          position: 0
+          parent: 12
+    - Expression:
+        Alias:
+          name: a
+          child: 12
+    - Expression:
+        Reference:
+          targets:
+            - 0
+            - 1
+          position: 1
+          parent: 12
+    - Expression:
+        Alias:
+          name: b
+          child: 14
+    - Expression:
+        Row:
+          list:
+            - 13
+            - 15
+          distribution: ~
+    - Relational:
+        UnionAll:
+          children:
+            - 5
+            - 11
+          id: 12
+          output: 16
 relations:
   t1:
     Segment:
diff --git a/tests/artifactory/ir/operator/output_aliases.yaml b/tests/artifactory/ir/operator/output_aliases.yaml
index af001f8357..e579b6f4ef 100644
--- a/tests/artifactory/ir/operator/output_aliases.yaml
+++ b/tests/artifactory/ir/operator/output_aliases.yaml
@@ -1,34 +1,35 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        branch: Left
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        branch: Left
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      ScanRelation:
-        output: 4
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          branch: Left
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          branch: Left
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        ScanRelation:
+          output: 4
+          relation: t
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/output_aliases_duplicates.yaml b/tests/artifactory/ir/operator/output_aliases_duplicates.yaml
index 80037d6250..35451fab8c 100644
--- a/tests/artifactory/ir/operator/output_aliases_duplicates.yaml
+++ b/tests/artifactory/ir/operator/output_aliases_duplicates.yaml
@@ -1,34 +1,35 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        branch: Left
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        branch: Left
-        position: 1
-  - Expression:
-      Alias:
-        name: a
-        child: 2
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      ScanRelation:
-        output: 4
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          branch: Left
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          branch: Left
+          position: 1
+    - Expression:
+        Alias:
+          name: a
+          child: 2
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        ScanRelation:
+          output: 4
+          relation: t
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/output_aliases_oor.yaml b/tests/artifactory/ir/operator/output_aliases_oor.yaml
index 25c4f79749..77f745543b 100644
--- a/tests/artifactory/ir/operator/output_aliases_oor.yaml
+++ b/tests/artifactory/ir/operator/output_aliases_oor.yaml
@@ -1,25 +1,26 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        branch: Left
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Row:
-        list:
-          - 1
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      ScanRelation:
-        output: 42
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          branch: Left
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Row:
+          list:
+            - 1
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        ScanRelation:
+          output: 42
+          relation: t
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/output_aliases_unsupported_type.yaml b/tests/artifactory/ir/operator/output_aliases_unsupported_type.yaml
index 0fc3974c11..0ac6e199bb 100644
--- a/tests/artifactory/ir/operator/output_aliases_unsupported_type.yaml
+++ b/tests/artifactory/ir/operator/output_aliases_unsupported_type.yaml
@@ -1,30 +1,31 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        branch: Left
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        branch: Left
-        position: 1
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 2
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      ScanRelation:
-        output: 3
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          branch: Left
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          branch: Left
+          position: 1
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 2
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        ScanRelation:
+          output: 3
+          relation: t
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/projection.yaml b/tests/artifactory/ir/operator/projection.yaml
index 3319f0d415..716cc9e52d 100644
--- a/tests/artifactory/ir/operator/projection.yaml
+++ b/tests/artifactory/ir/operator/projection.yaml
@@ -4,61 +4,62 @@
 #
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-        distribution:
-          Segment:
-            key:
-              - 1
-  - Relational:
-      ScanRelation:
-        output: 4
-        id: 0
-        relation: t
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 5 
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 6
-  - Expression:
-      Row:
-        list:
-          - 7
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      Projection:
-        id: 5
-        children:
-          - 5
-        output: 8
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+          distribution:
+            Segment:
+              key:
+                - 1
+    - Relational:
+        ScanRelation:
+          output: 4
+          id: 0
+          relation: t
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 5 
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 6
+    - Expression:
+        Row:
+          list:
+            - 7
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        Projection:
+          id: 5
+          children:
+            - 5
+          output: 8
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/scan_rel.yaml b/tests/artifactory/ir/operator/scan_rel.yaml
index 113978fc18..84dac6a89a 100644
--- a/tests/artifactory/ir/operator/scan_rel.yaml
+++ b/tests/artifactory/ir/operator/scan_rel.yaml
@@ -1,58 +1,59 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        position: 1
-        parent: 0
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Reference:
-        targets: ~
-        position: 2
-        parent: 0
-  - Expression:
-      Alias:
-        name: c
-        child: 4
-  - Expression:
-      Reference:
-        targets: ~
-        position: 3
-        parent: 0
-  - Expression:
-      Alias:
-        name: d
-        child: 6
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-          - 5
-          - 7
-        distribution:
-          Segment:
-            key:
-              - 1
-              - 0 
-  - Relational:
-      ScanRelation:
-        output: 8
-        id: 0
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          position: 1
+          parent: 0
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Reference:
+          targets: ~
+          position: 2
+          parent: 0
+    - Expression:
+        Alias:
+          name: c
+          child: 4
+    - Expression:
+        Reference:
+          targets: ~
+          position: 3
+          parent: 0
+    - Expression:
+        Alias:
+          name: d
+          child: 6
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+            - 5
+            - 7
+          distribution:
+            Segment:
+              key:
+                - 1
+                - 0 
+    - Relational:
+        ScanRelation:
+          output: 8
+          id: 0
+          relation: t
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/selection.yaml b/tests/artifactory/ir/operator/selection.yaml
index b20ea82698..c824d498ec 100644
--- a/tests/artifactory/ir/operator/selection.yaml
+++ b/tests/artifactory/ir/operator/selection.yaml
@@ -1,135 +1,136 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 2
-  - Expression:
-      Alias:
-        name: c
-        child: 4
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 3
-  - Expression:
-      Alias:
-        name: d
-        child: 6
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-          - 5
-          - 7
-        distribution:
-          Segment:
-            key:
-              - 1
-              - 0
-  - Relational:
-      ScanRelation:
-        id: 0
-        output: 8
-        relation: t
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 10 
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 10
-  - Expression:
-      Constant:
-        value:
-          Number: \"10\"
-  - Expression:
-      Bool:
-        left: 11
-        op: Gt
-        right: 12
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        parent: 10 
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 14
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        parent: 10 
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 16
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        parent: 10 
-        position: 2
-  - Expression:
-      Alias:
-        name: c
-        child: 18
-  - Expression:
-      Reference:
-        targets:
-          - 0
-        parent: 10 
-        position: 3
-  - Expression:
-      Alias:
-        name: d
-        child: 20
-  - Expression:
-      Row:
-        list:
-          - 15
-          - 17
-          - 19
-          - 21
-        distribution:
-          Segment:
-            key:
-              - 1
-              - 0
-  - Relational:
-      Selection:
-        children:
-          - 9
-        id: 10
-        filter: 13
-        output: 22
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 2
+    - Expression:
+        Alias:
+          name: c
+          child: 4
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 3
+    - Expression:
+        Alias:
+          name: d
+          child: 6
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+            - 5
+            - 7
+          distribution:
+            Segment:
+              key:
+                - 1
+                - 0
+    - Relational:
+        ScanRelation:
+          id: 0
+          output: 8
+          relation: t
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 10 
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 10
+    - Expression:
+        Constant:
+          value:
+            Number: \"10\"
+    - Expression:
+        Bool:
+          left: 11
+          op: Gt
+          right: 12
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          parent: 10 
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 14
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          parent: 10 
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 16
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          parent: 10 
+          position: 2
+    - Expression:
+        Alias:
+          name: c
+          child: 18
+    - Expression:
+        Reference:
+          targets:
+            - 0
+          parent: 10 
+          position: 3
+    - Expression:
+        Alias:
+          name: d
+          child: 20
+    - Expression:
+        Row:
+          list:
+            - 15
+            - 17
+            - 19
+            - 21
+          distribution:
+            Segment:
+              key:
+                - 1
+                - 0
+    - Relational:
+        Selection:
+          children:
+            - 9
+          id: 10
+          filter: 13
+          output: 22
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/operator/sub_query.yaml b/tests/artifactory/ir/operator/sub_query.yaml
index 7fb0473eae..8532afaf9c 100644
--- a/tests/artifactory/ir/operator/sub_query.yaml
+++ b/tests/artifactory/ir/operator/sub_query.yaml
@@ -1,71 +1,72 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 0 
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 2
-  - Expression:
-      Row:
-        list:
-          - 1
-          - 3
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      ScanRelation:
-        output: 4
-        id: 0
-        relation: t
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 6
-        position: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 6
-  - Expression:
-      Reference:
-        targets: ~
-        parent: 6
-        position: 1
-  - Expression:
-      Alias:
-        name: b
-        child: 8
-  - Expression:
-      Row:
-        list:
-          - 7
-          - 9
-        distribution:
-          Segment:
-            key:
-              - 0
-  - Relational:
-      ScanSubQuery:
-        alias: sq
-        id: 6
-        children:
-          - 5
-        output: 10
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 0 
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 2
+    - Expression:
+        Row:
+          list:
+            - 1
+            - 3
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        ScanRelation:
+          output: 4
+          id: 0
+          relation: t
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 6
+          position: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 6
+    - Expression:
+        Reference:
+          targets: ~
+          parent: 6
+          position: 1
+    - Expression:
+        Alias:
+          name: b
+          child: 8
+    - Expression:
+        Row:
+          list:
+            - 7
+            - 9
+          distribution:
+            Segment:
+              key:
+                - 0
+    - Relational:
+        ScanSubQuery:
+          alias: sq
+          id: 6
+          children:
+            - 5
+          output: 10
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/plan_no_top.yaml b/tests/artifactory/ir/plan_no_top.yaml
index 300337df6e..3e0850bd51 100644
--- a/tests/artifactory/ir/plan_no_top.yaml
+++ b/tests/artifactory/ir/plan_no_top.yaml
@@ -1,24 +1,25 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Row:
-        list:
-          - 1
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 2
-        id: 0
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Row:
+          list:
+            - 1
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 2
+          id: 0
+          relation: t
 relations:
   t:
     Segment:
diff --git a/tests/artifactory/ir/plan_oor_top.yaml b/tests/artifactory/ir/plan_oor_top.yaml
index be6b86d6cb..6acd565a4d 100644
--- a/tests/artifactory/ir/plan_oor_top.yaml
+++ b/tests/artifactory/ir/plan_oor_top.yaml
@@ -1,24 +1,25 @@
 ---
 nodes:
-  - Expression:
-      Reference:
-        targets: ~
-        position: 0
-        parent: 0
-  - Expression:
-      Alias:
-        name: a
-        child: 0
-  - Expression:
-      Row:
-        list:
-          - 1
-        distribution: ~
-  - Relational:
-      ScanRelation:
-        output: 2
-        id: 0
-        relation: t
+  arena:
+    - Expression:
+        Reference:
+          targets: ~
+          position: 0
+          parent: 0
+    - Expression:
+        Alias:
+          name: a
+          child: 0
+    - Expression:
+        Row:
+          list:
+            - 1
+          distribution: ~
+    - Relational:
+        ScanRelation:
+          output: 2
+          id: 0
+          relation: t
 relations:
   t:
     Segment:
-- 
GitLab