agozhiy commented on a change in pull request #1779: DRILL-7222: Visualize 
estimated and actual row counts for a query
URL: https://github.com/apache/drill/pull/1779#discussion_r310644723
 
 

 ##########
 File path: exec/java-exec/src/main/resources/rest/profile/profile.ftl
 ##########
 @@ -587,6 +622,49 @@
       if (e.target.form) 
         <#if 
model.isOnlyImpersonationEnabled()>doSubmitQueryWithUserName()<#else>doSubmitQueryWithAutoLimit()</#if>;
     });
+
+    // Convert scientific to Decimal [Ref: 
https://gist.github.com/jiggzson/b5f489af9ad931e3d186]
+    function scientificToDecimal(num) {
+      //if the number is in scientific notation remove it
+      if(/\d+\.?\d*e[\+\-]*\d+/i.test(num)) {
+        var zero = '0',
+            parts = String(num).toLowerCase().split('e'), //split into coeff 
and exponent
+            e = parts.pop(),//store the exponential part
+            l = Math.abs(e), //get the number of zeros
+            sign = e/l,
+            coeff_array = parts[0].split('.');
+        if(sign === -1) {
+            coeff_array[0] = Math.abs(coeff_array[0]);
+            num = '-'+zero + '.' + new Array(l).join(zero) + 
coeff_array.join('');
+        }
+        else {
+            var dec = coeff_array[1];
+            if(dec) l = l - dec.length;
+            num = coeff_array.join('') + new Array(l+1).join(zero);
+        }
+      }
+      return num;
+    }
+
+    // Extract estimated rowcount map
+    var opRowCountMap = {};
+    // Get OpId-Rowocunt Map
+    function buildRowCountMap() {
+      var phyText = $('#query-physical').find('pre').text();
+      var opLines = phyText.split("\n");
+      for (var l in opLines) {
+        var line = opLines[l];
+        if (line.trim().length > 0) {
+          var opId = line.match(/\d+-\d+/g)[0];
+          var opRowCount = line.match(/rowcount = \S+/g)[0].split(' 
')[2].replace(',','').trim();
 
 Review comment:
   ```suggestion
             var opRowCount = line.match(/rowcount = (\d+.\d+)/)[1];
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to