kgyrtkirk commented on code in PR #15241:
URL: https://github.com/apache/druid/pull/15241#discussion_r1374290163
##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java:
##########
@@ -1473,13 +1481,78 @@ private WindowOperatorQuery toWindowQuery()
);
}
+ /**
+ * Create an OperatorQuery which runs an order on top of a scan.
+ */
+ @Nullable
+ private WindowOperatorQuery toScanAndSortQuery()
+ {
+ if (sorting == null
+ || sorting.getOrderBys().isEmpty()
+ || sorting.getProjection() != null) {
+ return null;
+ }
+
+ ScanQuery scan = toScanQuery(false);
+ if (scan == null) {
+ return null;
+ }
+
+ // Reject cases which would sort the datasource directly
+ if (dataSource != DruidOuterQueryRel.DUMMY_DATA_SOURCE &&
dataSource.isConcrete()) {
Review Comment:
I intentionally wanted to check for the reference of that object - so that
it identifies that it was called from [this point in
DruidOuterQuery](https://github.com/apache/druid/blob/60c2ad597ab44610298e94987582443368863269/sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidOuterQueryRel.java#L123)
later this should probably revised - as it's already a bit odd that
`OuterRel` passes a `DataSource` which is `concreate` - meanwhile its known to
be a subquery
--
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]