You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/12/04 14:22:53 UTC

[GitHub] [calcite] rubenada commented on a change in pull request #1613: [CALCITE-3542] Implement RepeatUnion All=false

rubenada commented on a change in pull request #1613: [CALCITE-3542] Implement RepeatUnion All=false
URL: https://github.com/apache/calcite/pull/1613#discussion_r353771215
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/enumerable/EnumerableRepeatUnionHierarchyTest.java
 ##########
 @@ -55,33 +58,60 @@
   private static final String EMP4 = "empid=4; name=Emp4";
   private static final String EMP5 = "empid=5; name=Emp5";
 
+  private static final int[] ID1 = new int[]{1};
+  private static final String ID1_STR = Arrays.toString(ID1);
+  private static final int[] ID2 = new int[]{2};
+  private static final String ID2_STR = Arrays.toString(ID2);
+  private static final int[] ID3 = new int[]{3};
+  private static final String ID3_STR = Arrays.toString(ID3);
+  private static final int[] ID4 = new int[]{4};
+  private static final String ID4_STR = Arrays.toString(ID4);
+  private static final int[] ID5 = new int[]{5};
+  private static final String ID5_STR = Arrays.toString(ID5);
+  private static final int[] ID3_5 = new int[]{3, 5};
+  private static final String ID3_5_STR = Arrays.toString(ID3_5);
+  private static final int[] ID1_3 = new int[]{1, 3};
+  private static final String ID1_3_STR = Arrays.toString(ID1_3);
+
   public static Iterable<Object[]> data() {
+
     return Arrays.asList(new Object[][] {
-        { 1, true, -1, new String[]{EMP1} },
-        { 2, true, -2, new String[]{EMP2, EMP1} },
-        { 3, true, -1, new String[]{EMP3, EMP2, EMP1} },
-        { 4, true, -5, new String[]{EMP4, EMP1} },
-        { 5, true, -1, new String[]{EMP5, EMP2, EMP1} },
-        { 3, true,  0, new String[]{EMP3} },
-        { 3, true,  1, new String[]{EMP3, EMP2} },
-        { 3, true,  2, new String[]{EMP3, EMP2, EMP1} },
-        { 3, true, 10, new String[]{EMP3, EMP2, EMP1} },
-
-        { 1, false, -1, new String[]{EMP1, EMP2, EMP4, EMP3, EMP5} },
-        { 2, false, -10, new String[]{EMP2, EMP3, EMP5} },
-        { 3, false, -100, new String[]{EMP3} },
-        { 4, false, -1, new String[]{EMP4} },
-        { 1, false,  0, new String[]{EMP1} },
-        { 1, false,  1, new String[]{EMP1, EMP2, EMP4} },
-        { 1, false,  2, new String[]{EMP1, EMP2, EMP4, EMP3, EMP5} },
-        { 1, false, 20, new String[]{EMP1, EMP2, EMP4, EMP3, EMP5} },
+        { true, ID1, ID1_STR, true, -1, new String[]{EMP1} },
+        { true, ID2, ID2_STR, true, -2, new String[]{EMP2, EMP1} },
+        { true, ID3, ID3_STR, true, -1, new String[]{EMP3, EMP2, EMP1} },
+        { true, ID4, ID4_STR, true, -5, new String[]{EMP4, EMP1} },
+        { true, ID5, ID5_STR, true, -1, new String[]{EMP5, EMP2, EMP1} },
+        { true, ID3, ID3_STR, true,  0, new String[]{EMP3} },
+        { true, ID3, ID3_STR, true,  1, new String[]{EMP3, EMP2} },
+        { true, ID3, ID3_STR, true,  2, new String[]{EMP3, EMP2, EMP1} },
+        { true, ID3, ID3_STR, true, 10, new String[]{EMP3, EMP2, EMP1} },
+
+        { true, ID1, ID1_STR, false, -1, new String[]{EMP1, EMP2, EMP4, EMP3, EMP5} },
+        { true, ID2, ID2_STR, false, -10, new String[]{EMP2, EMP3, EMP5} },
+        { true, ID3, ID3_STR, false, -100, new String[]{EMP3} },
+        { true, ID4, ID4_STR, false, -1, new String[]{EMP4} },
+        { true, ID1, ID1_STR, false,  0, new String[]{EMP1} },
+        { true, ID1, ID1_STR, false,  1, new String[]{EMP1, EMP2, EMP4} },
+        { true, ID1, ID1_STR, false,  2, new String[]{EMP1, EMP2, EMP4, EMP3, EMP5} },
+        { true, ID1, ID1_STR, false, 20, new String[]{EMP1, EMP2, EMP4, EMP3, EMP5} },
+
+        // tests to verify all=true vs all=false
+        { true, ID3_5, ID3_5_STR, true, -1, new String[]{EMP3, EMP5, EMP2, EMP2, EMP1, EMP1} },
+        { false, ID3_5, ID3_5_STR, true, -1, new String[]{EMP3, EMP5, EMP2, EMP1} },
+        { true, ID3_5, ID3_5_STR, true, 0, new String[]{EMP3, EMP5} },
+        { false, ID3_5, ID3_5_STR, true, 0, new String[]{EMP3, EMP5} },
+        { true, ID3_5, ID3_5_STR, true, 1, new String[]{EMP3, EMP5, EMP2, EMP2} },
+        { false, ID3_5, ID3_5_STR, true, 1, new String[]{EMP3, EMP5, EMP2} },
+        { true, ID1_3, ID1_3_STR, false, -1, new String[]{EMP1, EMP3, EMP2, EMP4, EMP3, EMP5} },
+        { false, ID1_3, ID1_3_STR, false, -1, new String[]{EMP1, EMP3, EMP2, EMP4, EMP5} },
     });
   }
 
-  @ParameterizedTest
+  @ParameterizedTest(name = "{index} : hierarchy(startIds:{2}, ascendant:{3}, "
+      + "maxDepth:{4}, all:{0})")
   @MethodSource("data")
-  public void testHierarchy(int startId, boolean ascendant,
-                            int maxDepth, String[] expected) {
+  public void testHierarchy(boolean all, int[] startIds, String startIdsStr,
+                            boolean ascendant, int maxDepth, String[] expected) {
 
 Review comment:
   Agree, fixed.

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


With regards,
Apache Git Services