gortiz commented on code in PR #14296:
URL: https://github.com/apache/pinot/pull/14296#discussion_r1820955377


##########
pinot-query-planner/src/test/java/org/apache/pinot/query/planner/logical/GroupedStagesTest.java:
##########
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.query.planner.logical;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+
+public class GroupedStagesTest extends StagesTestBase {
+
+  @Test
+  public void addOrdered() {
+    when(
+        join(
+            exchange(1, tableScan("T1")),
+            exchange(2, tableScan("T2"))
+        )
+    );
+
+    GroupedStages.Mutable mutable = new GroupedStages.Mutable()
+        .addNewGroup(stage(0))
+        .addNewGroup(stage(1))
+        .addNewGroup(stage(2));
+    assertEquals(mutable.toString(), "[[0], [1], [2]]");
+  }
+
+  @Test
+  public void addUnordered() {
+    when(
+        join(
+            exchange(1, tableScan("T1")),
+            exchange(2, tableScan("T2"))
+        )
+    );
+    GroupedStages.Mutable mutable = new GroupedStages.Mutable()
+        .addNewGroup(stage(2))
+        .addNewGroup(stage(1))
+        .addNewGroup(stage(0));
+    assertEquals(mutable.toString(), "[[0], [1], [2]]");
+  }
+
+  @Test
+  public void addEquivalence() {
+    when(
+        join(
+            exchange(1, tableScan("T1")),
+            exchange(2, tableScan("T2"))
+        )
+    );
+    GroupedStages.Mutable mutable = new GroupedStages.Mutable()
+        .addNewGroup(stage(0))
+        .addNewGroup(stage(1))
+        .addToGroup(stage(0), stage(2));
+    assertEquals(mutable.toString(), "[[0, 2], [1]]");

Review Comment:
   I don't follow you. `StagesTestBase` is just an API to create these nodes. 
It doesn't care about correctness. Same here. GroupedStagesTest doesn't care 
about what being equivalent mean. It is just a [matemathical partition of a set 
of nodes](https://en.wikipedia.org/wiki/Partition_of_a_set). How nodes are 
partition is defined in `EquivalentStagesFinder`.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to