gianm commented on code in PR #13902:
URL: https://github.com/apache/druid/pull/13902#discussion_r1130199792
##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/Windowing.java:
##########
@@ -396,4 +434,59 @@ public int getConstantInt(int argPosition)
return ((Number) getConstantArgument(argPosition).getValue()).intValue();
}
}
+
+ /**
+ * Return a list of {@link ColumnWithDirection} corresponding to a {@link
RelCollation}.
+ *
+ * @param collation collation
+ * @param sourceRowSignature signature of the collated rows
+ */
+ private static LinkedHashSet<ColumnWithDirection>
computeSortColumnsFromRelCollation(
+ final RelCollation collation,
+ final RowSignature sourceRowSignature
+ )
+ {
+ final LinkedHashSet<ColumnWithDirection> retVal = new LinkedHashSet<>();
+
+ for (RelFieldCollation fieldCollation : collation.getFieldCollations()) {
+ ColumnWithDirection.Direction direction = null;
+
+ switch (fieldCollation.getDirection()) {
+ case ASCENDING:
+ case STRICTLY_ASCENDING:
+ direction = ColumnWithDirection.Direction.ASC;
+ break;
+
+ case DESCENDING:
+ case STRICTLY_DESCENDING:
+ direction = ColumnWithDirection.Direction.DESC;
+ break;
+ }
Review Comment:
Adjusted it to return `retVal` immediately. I'm not sure if we'll ever see
CLUSTERED order, but if we do, we should treat it as unsorted.
--
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]