You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2017/02/16 16:22:53 UTC

[3/4] incubator-trafodion git commit: [TRAFODION-2854] Improve SET STATISTICS command to display the information in new format

[TRAFODION-2854] Improve SET STATISTICS command to display the information in new format

Currently SET STATISTICS ON | OFF alone is supported. It is improved to take some more options

SET STATISTICS PERTABLE ;
SET STATISTICS PROGRESS ;
SET STATISTICS DEFAULT ;
This will display pertable, progress, operator level statistics for the these options respectively.

SET STATISTICS ALL will display both progress and operator level statistics.

These commands are valid both in sqlci and trafci.


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

Branch: refs/heads/master
Commit: 6973d3a120aaa02a45157622517ed94559cb5899
Parents: f6f4402
Author: selvaganesang <se...@esgyn.com>
Authored: Thu Feb 16 01:48:11 2017 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Thu Feb 16 01:48:11 2017 +0000

----------------------------------------------------------------------
 .../java/org/trafodion/ci/DatabaseQuery.java    |   23 +-
 .../java/org/trafodion/ci/InterfaceQuery.java   |   14 +-
 .../src/main/java/org/trafodion/ci/Session.java |   11 +
 core/sql/regress/core/EXPECTEDRTS               | 1828 +++++++++++-------
 core/sql/regress/core/TESTRTS                   |   11 +
 core/sql/sqlci/SqlciStats.cpp                   |   44 +-
 core/sql/sqlci/sqlci_yacc.y                     |   49 +-
 7 files changed, 1196 insertions(+), 784 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6973d3a1/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
index 8b8b2ac..ec57060 100644
--- a/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/DatabaseQuery.java
@@ -306,17 +306,32 @@ public class DatabaseQuery extends QueryWrapper
          //Overwrite the queryStr with the 'GET STATISTICS'
          //command. dbExec executes the command stored in
          //queryStr.
-         queryStr = getStatsCmd;
+         String qryRowCnt = qryObj.getRowCount();
+         if (sessObj.getSessionStatsType().equals("ALL"))
+         {
+            queryStr = "GET STATISTICS FOR QID CURRENT PROGRESS";
+            qryObj.resetQueryText(queryStr);
+            parser.setRemainderStr(queryStr);
+            qryObj.setRowCount(null);
+            execGet(false);
+         }
+         if (sessObj.getSessionStatsType().equals("PERTABLE"))
+            queryStr = "GET STATISTICS FOR QID CURRENT PERTABLE";
+         else if (sessObj.getSessionStatsType().equals("PROGRESS"))
+            queryStr = "GET STATISTICS FOR QID CURRENT PROGRESS";
+         else if (sessObj.getSessionStatsType().equals("DEFAULT"))
+            queryStr = "GET STATISTICS FOR QID CURRENT DEFAULT";
+         else if (sessObj.getSessionStatsType().equals("ALL"))
+            queryStr = "GET STATISTICS FOR QID CURRENT DEFAULT";
+         else
+            queryStr = getStatsCmd;
          qryObj.resetQueryText(queryStr);
          parser.setRemainderStr(queryStr);
-         String qryRowCnt = qryObj.getRowCount();
          qryObj.setRowCount(null);
          execGet(false);
          //Reset the record count to row count of the
          //original query
          qryObj.setRowCount(qryRowCnt);
-                 
-         
       }
 
    }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6973d3a1/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
index 5bd73cb..026486f 100644
--- a/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/InterfaceQuery.java
@@ -1977,7 +1977,9 @@ public class InterfaceQuery extends QueryWrapper implements SessionDefaults {
 				break;
 			}
 			setValue = setValue.toUpperCase();
-			if ((!setValue.equals("ON") && !setValue.equals("OFF"))) {
+			if (!setValue.equals("ON") && !setValue.equals("OFF")
+                              && !setValue.equals("PERTABLE") && !setValue.equals("PROGRESS") && !setValue.equals("DEFAULT")
+                              && !setValue.equals("ALL")) {
 				writeSyntaxError(this.queryStr,
 						setValue + parser.getRemainderStr());
 				break;
@@ -1986,13 +1988,13 @@ public class InterfaceQuery extends QueryWrapper implements SessionDefaults {
 				writeSyntaxError(this.queryStr, parser.getRemainderStr());
 				break;
 			}
-			if (setValue.equals("ON")) {
-				sessObj.setSessionStatsEnabled(true);
-			} else {
+			if (setValue.equals("OFF")) {
 				sessObj.setSessionStatsEnabled(false);
+			} else {
+				sessObj.setSessionStatsEnabled(true);
 			}
-			envMap.put("STATISTICS", sessObj.isSessionStatsEnabled() ? "ON"
-					: "OFF");
+                        sessObj.setSessionStatsType(setValue);
+			envMap.put("STATISTICS", setValue);
 			break;
 
 		case SET_MARKUP:

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/6973d3a1/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
----------------------------------------------------------------------
diff --git a/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java b/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
index e6c9e30..62d26f5 100644
--- a/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/Session.java
@@ -111,6 +111,7 @@ public class Session extends RepObjInterface
    String varSessionSQLPrompt=SessionDefaults.DEFAULT_SQL_PROMPT;
    boolean ampmFmt = false;
    boolean sessionStats = false;
+   String sessionStatsType;
    LFProperties lfProps = null;
    Process procObj=null;
    private HTMLObject htmlObj=null;
@@ -1262,6 +1263,16 @@ static {
       return lfProps;
    }
 
+   public String getSessionStatsType()
+   {
+      return sessionStatsType;
+   }
+
+   public void setSessionStatsType(String sessionStatsType)
+   {
+      this.sessionStatsType = sessionStatsType;
+   }
+
    public void setLFProps(LFProperties lfProps)
    {
       this.lfProps = lfProps;