hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hubertzh...@apache.org
Subject [5/5] incubator-hawq git commit: HAWQ-673. Unify out put of explain analyze.
Date Thu, 14 Apr 2016 08:01:29 GMT
HAWQ-673. Unify out put of explain analyze.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/e9c5dc3d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/e9c5dc3d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/e9c5dc3d

Branch: refs/heads/master
Commit: e9c5dc3d78862e872e4d461cee25106be007f908
Parents: 63ef549
Author: hzhang2 <zhanghuan929@163.com>
Authored: Thu Apr 14 15:55:42 2016 +0800
Committer: hzhang2 <zhanghuan929@163.com>
Committed: Thu Apr 14 15:55:42 2016 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbexplain.c | 37 +++++++------------------------------
 src/include/cdb/cdbexplain.h | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/e9c5dc3d/src/backend/cdb/cdbexplain.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbexplain.c b/src/backend/cdb/cdbexplain.c
index bea98ca..d6583b8 100644
--- a/src/backend/cdb/cdbexplain.c
+++ b/src/backend/cdb/cdbexplain.c
@@ -305,6 +305,7 @@ cdbexplain_localExecStats(struct PlanState                 *planstate,
     ctx.send.notebuf = &showstatctx->extratextbuf;
 
     /* Set up a temporary StatHdr for both collecting and depositing stats. */
+    gethostname(ctx.send.hdr.hostname,SEGMENT_IDENTITY_NAME_LENGTH-1);
     ctx.msgptrs[0] = &ctx.send.hdr;
     ctx.send.hdr.segindex = GetQEIndex();
     ctx.send.hdr.nInst = 1;
@@ -921,7 +922,7 @@ cdbexplain_depStatAcc_upd(CdbExplain_DepStatAcc    *acc,
         acc->nsimax = nsi;
     }
 
-    if (acc->max_total < nsi->total)
+    if (acc->max_total <= nsi->total)
     {
 		acc->rshLast = rsh;
 		acc->rsiLast = rsi;
@@ -1424,7 +1425,7 @@ cdbexplain_formatSegNoParenthesis(char *outbuf, int bufsize, int segindex,
int n
 	Assert(outbuf != NULL &&  "CDBEXPLAIN: char buffer is null");
 	Assert(bufsize > 0 &&  "CDBEXPLAIN: size of char buffer is zero");
 
-    if ( nInst > 1 && segindex >= 0){
+    if ( nInst >= 0 && segindex >= -1){
     	/*check if truncation occurs */
 #ifdef USE_ASSERT_CHECKING
     	int nchars_written =
@@ -1564,7 +1565,7 @@ cdbexplain_showExecStats(struct PlanState              *planstate,
         case T_BitmapIndexScanState:
             s_row = "";
             s_rows = "";
-            if (ns->ntuples.vcnt > 1){
+            if (ns->ntuples.vcnt >= 0){
                 appendStringInfo(str,
                                  "Bitmaps out:  Avg %.1f x %d workers."
                                  "  Max/Last(%s/%s) %.0f/%.0f rows",
@@ -1574,15 +1575,9 @@ cdbexplain_showExecStats(struct PlanState              *planstate,
 								ns->ntuples.vmax,ns->ntuples.vlast);
                 containMaxRowAndLast = true;
             }
-            else
-                appendStringInfo(str,
-                                 "Bitmaps out:  %s%.0f%s",
-								 noRowRequested,
-                                 ns->ntuples.vmax,
-								 segbufWithParenthese);
             break;
         case T_HashState:
-            if (ns->ntuples.vcnt > 1){
+            if (ns->ntuples.vcnt >= 0){
                 appendStringInfo(str,
                                  "Rows in:  Avg %.1f rows x %d workers."
                                  "  Max/Last(%s/%s) %.0f/%.0f rows",
@@ -1592,15 +1587,9 @@ cdbexplain_showExecStats(struct PlanState              *planstate,
 								ns->ntuples.vmax,ns->ntuples.vlast);
                 containMaxRowAndLast = true;
             }
-            else
-                appendStringInfo(str,
-                                 "Rows in:  %s%.0f rows%s",
-								 noRowRequested,
-                                 ns->ntuples.vmax,
-								segbufWithParenthese);
             break;
         case T_MotionState:
-            if (ns->ntuples.vcnt > 1){
+            if (ns->ntuples.vcnt >= 0){
                 appendStringInfo(str,
                                  "Rows out:  Avg %.1f rows x %d workers"
                                  " at destination.  Max/Last(%s/%s) %.0f/%.0f rows",
@@ -1610,15 +1599,9 @@ cdbexplain_showExecStats(struct PlanState              *planstate,
 								ns->ntuples.vmax,ns->ntuples.vlast);
                 containMaxRowAndLast = true;
             }
-            else
-                appendStringInfo(str,
-                                 "Rows out:  %s%.0f rows at destination%s",
-								 noRowRequested,
-                                 ns->ntuples.vmax,
-								segbufWithParenthese);
             break;
         default:
-            if (ns->ntuples.vcnt > 1){
+            if (ns->ntuples.vcnt >= 0){
                 appendStringInfo(str,
                                  "Rows out:  Avg %.1f rows x %d workers."
                                  "  Max/Last(%s/%s) %.0f/%.0f rows",
@@ -1628,12 +1611,6 @@ cdbexplain_showExecStats(struct PlanState              *planstate,
                                  ns->ntuples.vmax,ns->ntuples.vlast);
                 containMaxRowAndLast = true;
             }
-            else
-                appendStringInfo(str,
-                                 "Rows out:  %s%.0f rows%s",
-								 noRowRequested,
-                                 ns->ntuples.vmax,
-								segbufWithParenthese);
     }
 
     if( containMaxRowAndLast ){

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/e9c5dc3d/src/include/cdb/cdbexplain.h
----------------------------------------------------------------------
diff --git a/src/include/cdb/cdbexplain.h b/src/include/cdb/cdbexplain.h
index 8dde233..761b48d 100644
--- a/src/include/cdb/cdbexplain.h
+++ b/src/include/cdb/cdbexplain.h
@@ -74,12 +74,22 @@ cdbexplain_agg_init1(CdbExplain_Agg *agg, double v, int id)
 static inline bool
 cdbexplain_agg_upd(CdbExplain_Agg *agg, double v, int id,char* hostname)
 {
-    if (v > 0)
+    if(v == 0){
+      if (agg->vcnt == 0)
+        {
+            agg->vmax = v;
+            agg->imax = id;
+            if(hostname!=NULL)
+                strncpy(agg->hostnamemax, hostname,SEGMENT_IDENTITY_NAME_LENGTH-1);
+            return true;
+        }
+    }
+    else if (v > 0)
     {
         agg->vsum += v;
         agg->vcnt++;
 
-        if (v > agg->vmax ||
+        if (v >= agg->vmax ||
             agg->vcnt == 0)
         {
             agg->vmax = v;


Mime
View raw message