klcodanr commented on code in PR #535: URL: https://github.com/apache/jackrabbit-oak/pull/535#discussion_r867017876
########## oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java: ########## @@ -1102,13 +1113,16 @@ private SelectorExecutionPlan getBestSelectorExecutionPlan( IndexPlan indexPlan = null; if (index instanceof AdvancedQueryIndex) { AdvancedQueryIndex advIndex = (AdvancedQueryIndex) index; - long maxEntryCount = limit; - if (offset > 0) { - if (offset + limit < 0) { + + long localLimit = limit.orElse(Long.MAX_VALUE); + long localOffset = offset.orElse(0L); + long maxEntryCount = localLimit; + if (localOffset > 0) { + if (localOffset + localLimit < 0) { Review Comment: It's a good point though, updated -- 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: dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org