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

 ##########
 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:
   Not required. Drill (Foreman, I think) itself removes the query during 
processing. That is why you don't need a semi-colon when submitting a query as 
well.

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