[ 
https://issues.apache.org/jira/browse/DRILL-7222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16900164#comment-16900164
 ] 

ASF GitHub Bot commented on DRILL-7222:
---------------------------------------

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

 ##########
 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();
+          if (opRowCount.includes("E")) {
+            opRowCountMap[opId] = 
parseInt(scientificToDecimal(opRowCount)).toLocaleString('en');
 
 Review comment:
   What if rowCount exceeds the int limit? It's type was made double on purpose.
 
----------------------------------------------------------------
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


> Visualize estimated and actual row counts for a query
> -----------------------------------------------------
>
>                 Key: DRILL-7222
>                 URL: https://issues.apache.org/jira/browse/DRILL-7222
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Web Server
>    Affects Versions: 1.16.0
>            Reporter: Kunal Khatua
>            Assignee: Kunal Khatua
>            Priority: Major
>              Labels: doc-impacting, user-experience
>             Fix For: 1.17.0
>
>
> With statistics in place, it would be useful to have the *estimated* rowcount 
> along side the *actual* rowcount query profile's operator overview.
> We can extract this from the Physical Plan section of the profile.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to