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


##########
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:
   I was thinking no, because  `query.getScanRowsLimit()` is set to 
`Long.MAX_VALUE` to indicate "unlimited", and if there is an offset then the 
addition will overflow. In this case setting the result to `Long.MAX_VALUE` is 
the right thing to do because it still means "unlimited".



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