sreemanamala commented on code in PR #16482:
URL: https://github.com/apache/druid/pull/16482#discussion_r1609167518


##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/Windowing.java:
##########
@@ -270,6 +278,74 @@ public static Windowing fromCalciteStuff(
     }
   }
 
+  /**
+   * A wrapper object which stores {@link 
org.apache.calcite.rel.core.Window.Group}
+   * along with its computed {@link WindowOperatorFactory}
+   *
+   * this allows us to sort the window groups in order to optimise the order 
of operators we would need to compute
+   * without losing the aggregate column name information (which is part of 
the computed WindowOperatorFactory)
+   */
+  private static class WindowGroupProcessorWrapper implements 
Comparable<WindowGroupProcessorWrapper>
+  {
+    private final Window.Group group;
+    private final OperatorFactory processorOperatorFactory;
+
+    public WindowGroupProcessorWrapper(Window.Group group, OperatorFactory 
processorOperatorFactory)
+    {
+      this.group = group;
+      this.processorOperatorFactory = processorOperatorFactory;
+    }
+
+    public Window.Group getGroup()
+    {
+      return group;
+    }
+
+    public OperatorFactory getProcessorOperatorFactory()
+    {
+      return processorOperatorFactory;
+    }
+
+    @Override
+    public int compareTo(WindowGroupProcessorWrapper o)
+    {
+      // Need to work on this method to optimise the order in which we need to 
process based on the partitions
+      // currently just moves the empty windows to the front

Review Comment:
   the order of remaining elements would be as is, since in all other cases we 
return 0 to look like they are same. Would that not be sufficient?



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