clintropolis commented on code in PR #18441:
URL: https://github.com/apache/druid/pull/18441#discussion_r2323311108


##########
multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ScanQueryFrameProcessor.java:
##########
@@ -497,4 +550,19 @@ private ColumnSelectorFactory 
wrapColumnSelectorFactoryIfNeeded(final ColumnSele
     }
     return baseColumnSelectorFactory;
   }
+
+  /**
+   * Returns the {@link ScanQuery#getScanRowsOffset()} plus {@link 
ScanQuery#getScanRowsLimit()}, or
+   * {@link Long#MAX_VALUE} if that addition would overflow.
+   */
+  private long getQueryOffsetPlusLimit()
+  {
+    final long sum = query.getScanRowsOffset() + query.getScanRowsLimit();
+    if (sum < 0) {
+      // Overflow
+      return Long.MAX_VALUE;

Review Comment:
   should this be a failure?



##########
multi-stage-query/src/main/java/org/apache/druid/msq/querykit/scan/ScanQueryFrameProcessor.java:
##########
@@ -479,6 +522,16 @@ private long setNextCursor(
     this.cursorCloser = cursorCloser;
     this.segment = segment;
     this.cursorOffset.reset();
+    this.cursorRowsRead = 0;
+
+    if (query.isLimited()
+        && ordering.size() >= query.getOrderBys().size()
+        && query.getOrderBys().equals(ordering.subList(0, 
query.getOrderBys().size()))) {

Review Comment:
   in the future it might be nice to have a 'same but reversed direction' check 
so that we could make reverse cursors match too



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