You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2015/08/21 02:36:58 UTC

[2/3] incubator-trafodion git commit: [TRAFODION-1460] - Allowing 'CURRENT' for qid

[TRAFODION-1460] - Allowing 'CURRENT' for qid

Within the same session, you can use

explain option 'f' for qid current

to display the explain plan of the recently compiled or executed statement.


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

Branch: refs/heads/master
Commit: daa0a478b57672c9855bbb3f3fa6c62da0b7a507
Parents: 3b21457
Author: selvaganesang <se...@esgyn.com>
Authored: Wed Aug 19 22:10:03 2015 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Wed Aug 19 22:10:03 2015 +0000

----------------------------------------------------------------------
 core/sql/executor/ExExplain.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/daa0a478/core/sql/executor/ExExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExplain.cpp b/core/sql/executor/ExExplain.cpp
index 8a271e6..28c64ce 100644
--- a/core/sql/executor/ExExplain.cpp
+++ b/core/sql/executor/ExExplain.cpp
@@ -1503,6 +1503,7 @@ RtsExplainFrag *ExExplainTcb::sendToSsmp()
   RtsExplainReq *explainReq;
   CliGlobals *cliGlobals = getGlobals()->castToExExeStmtGlobals()->
                         castToExMasterStmtGlobals()->getCliGlobals();
+  ContextCli *context = cliGlobals->currContext();
   if (cliGlobals->getStatsGlobals() == NULL)
   {
     // Runtime Stats not running.
@@ -1512,6 +1513,14 @@ RtsExplainFrag *ExExplainTcb::sendToSsmp()
     return NULL;
   }
 
+  ExMasterStats *masterStats;
+
+  if (strcasecmp(qid_, "CURRENT") == 0) {
+     if (context->getStats() != NULL && (masterStats = context->getStats()->getMasterStats()) != NULL) {
+        setQid(masterStats->getQueryId(), masterStats->getQueryIdLen()); 
+     }
+  }
+
   // Verify that we have valid parameters for each kind of request. If not, fill in the diagsArea
   // and return NULL.
   ExSsmpManager *ssmpManager = cliGlobals->getSsmpManager();