thomasmueller commented on code in PR #535:
URL: https://github.com/apache/jackrabbit-oak/pull/535#discussion_r861774043


##########
oak-api/src/main/java/org/apache/jackrabbit/oak/api/QueryEngine.java:
##########
@@ -91,6 +92,24 @@ Result executeQuery(
             String statement, String language, long limit, long offset,
             Map<String, ? extends PropertyValue> bindings,
             Map<String, String> mappings) throws ParseException;
+
+    /**
+     * Execute a query and get the result.
+     *
+     * @param statement the query statement
+     * @param language the language
+     * @param limit the maximum result set size (may not be negative but may 
be empty)
+     * @param offset the number of rows to skip (may not be negative but may 
be empty)
+     * @param bindings the bind variable value bindings
+     * @param mappings namespace prefix mappings
+     * @return the result
+     * @throws ParseException if the statement could not be parsed
+     * @throws IllegalArgumentException if there was an error executing the 
query
+     */
+    Result executeQuery(
+            String statement, String language, Optional<Long> limit, 
Optional<Long> offset,

Review Comment:
   @fabriziofortino 
   
   I don't have a strong opinion about this.
   
   As for the performance reason: for a method that is called a lot (like: put, 
log,...) , I would avoid Optional for performance reasons. But executeQuery 
isn't called that often, so that's not a good reason to avoid it.
   
   I see some advantages of Optional over magic values (-1 for infinity: make 
sure you always treat the magic value correctly), and some disadvantages (a bit 
harder to read).
   
   I would leave it up to the author, I think...



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

Reply via email to