sreemanamala commented on code in PR #16482:
URL: https://github.com/apache/druid/pull/16482#discussion_r1616226214
##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/Windowing.java:
##########
@@ -270,6 +279,74 @@ public static Windowing fromCalciteStuff(
}
}
+ /**
+ * A wrapper class which stores {@link WindowGroup}
+ * along with its computed {@link WindowOperatorFactory}
+ * <p>
+ * 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 WindowComputationProcessor
+ {
+ private final WindowGroup group;
+ private final OperatorFactory processorOperatorFactory;
+
+ public WindowComputationProcessor(WindowGroup group, OperatorFactory
processorOperatorFactory)
+ {
+ this.group = group;
+ this.processorOperatorFactory = processorOperatorFactory;
+ }
+
+ public WindowGroup getGroup()
+ {
+ return group;
+ }
+
+ public OperatorFactory getProcessorOperatorFactory()
+ {
+ return processorOperatorFactory;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ WindowComputationProcessor obj = (WindowComputationProcessor) o;
+ return Objects.equals(group, obj.group) && Objects.equals(
+ processorOperatorFactory,
+ obj.processorOperatorFactory
+ );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return Objects.hash(group, processorOperatorFactory);
+ }
+ }
+
+ /**
+ * Comparator on {@link WindowComputationProcessor}
+ * to move the empty windows to the front
+ */
+ private static final Comparator<WindowComputationProcessor>
MOVE_EMPTY_GROUPS_FIRST = (o1, o2) -> {
Review Comment:
moved
--
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]