kgyrtkirk commented on code in PR #15241:
URL: https://github.com/apache/druid/pull/15241#discussion_r1375184340


##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java:
##########
@@ -1474,12 +1487,93 @@ private WindowOperatorQuery toWindowQuery()
   }
 
   /**
-   * Return this query as a Scan query, or null if this query is not 
compatible with Scan.
+   * 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;
+    }
+
+    if (queryRunsOnHistorical()) {
+      // Currently only non-time orderings of subqueries are allowed.
+      List<String> orderByColumnNames = sorting.getOrderBys()
+          .stream().map(OrderByColumnSpec::getDimension)
+          .collect(Collectors.toList());
+      plannerContext.setPlanningError(
+          "SQL query requires ordering a table by non-time column [%s], which 
is not supported.",
+          orderByColumnNames);

Review Comment:
   I noticed it as well - however didn't digged into it before; I think the 
eclipse formatter of the project is outdated - I had to fix a few issues 
already (because checkstyle followed different rules).
   
   regarding this one: it was off as well; but I don't yet see a way to enable 
formatting to (1) but was able to set only (2)
   ```
   format_1(123,
       23123,
       3213,
       2321321
   );
   
   format_2(
       123,
       23123,
       3213,
       2321321
   );
   ```
   as a matter of fact I don't know if `format_1` would be the preffered or not.
   I've set `format_2`; as putting the closing `)` on the same line have caused 
quite a few annoying mistakes for me in the last couple days...
   
   more-or-less related: we could enforce these formatting things (see [this 
PR](https://github.com/apache/druid/pull/14937) ); but I didn't wanted to do it 
for the whole project before we agree on the rules we should follow



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