sohami commented on a change in pull request #1593: DRILL-6050: Provide a limit 
to number of rows fetched for a query in UI
URL: https://github.com/apache/drill/pull/1593#discussion_r245456256
 
 

 ##########
 File path: exec/java-exec/src/main/resources/rest/static/js/querySubmission.js
 ##########
 @@ -72,4 +82,26 @@ function submitQuery() {
             alert(errorThrown);
         }
     });
-}
\ No newline at end of file
+}
+
+//Wraps a query with Limit by directly changing the query in the hidden 
textbox in the UI (see /query.ftl)
+function wrapQuery() {
+    var origQueryText = $('#query').attr('value');
+    //dBug: console.log("Query Input:" + origQueryText);
+    var mustWrapWithLimit = $('input[name="forceLimit"]:checked').length > 0;
+    if (mustWrapWithLimit) {
+        var semicolonIdx = origQueryText.lastIndexOf(';');
+        //Check and eliminate trailing semicolon
+        if (semicolonIdx  == origQueryText.length-1 ) {
+          origQueryText = origQueryText.substring(0, semicolonIdx)
+        }
+        var qLimit = $('#queryLimit').val();
+        var wrappedQuery = "-- [autoLimit: " + qLimit + " rows]\nselect * from 
(\n" + origQueryText + "\n) limit " + qLimit;
 
 Review comment:
   Should we insert a semicolon in the end of wrapped query ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to