rubenada commented on a change in pull request #1020: [CALCITE-2812] Add 
algebraic operators to allow expressing recursive queries (Ruben Quesada Lopez)
URL: https://github.com/apache/calcite/pull/1020#discussion_r258412422
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java
 ##########
 @@ -6837,6 +6837,36 @@ public TranslatableTable view(String s) {
     }
   }
 
+  public static class HierarchySchema {
+    @Override public String toString() {
+      return "HierarchySchema";
+    }
+
+    public final Employee[] emps = {
+            new Employee(1, 10, "Emp1", 10000, 1000),
+            new Employee(2, 10, "Emp2", 8000, 500),
+            new Employee(3, 10, "Emp3", 7000, null),
+            new Employee(4, 10, "Emp4", 8000, 500),
+            new Employee(5, 10, "Emp5", 7000, null),
+    };
+    public final Department[] depts = {
+            new Department(10, "Dept", Arrays.asList(emps[0], emps[1], 
emps[2], emps[3], emps[4]),
+                    new Location(-122, 38)),
+    };
+
+    //      Emp1
+    //      /  \
+    //    Emp2  Emp4
+    //    /  \
+    // Emp3   Emp5
+    public final Hierarchy[] hierarchies = {
 
 Review comment:
   I think this design has two (small) advantages:
   - It can represent more complicated hierarchies, e.g. one employee with more 
than one manager (although this is currently not used in the test cases)
   - It requires 2 joins (instead of 1) to compute the hierarchy paths, so it 
allows us to show a trickier use case of recursive union + transient table scan

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to