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/12/22 17:18:33 UTC

[1/2] incubator-trafodion git commit: [TRAFODION-1714] Sample table population plan now printed before execution

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 55a5d00c6 -> 1f9b52a63


[TRAFODION-1714] Sample table population plan now printed before execution


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

Branch: refs/heads/master
Commit: 8a2085f2dfbf8fc6673bd7fb48099faeae3dd484
Parents: dd1b373
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Dec 21 19:49:35 2015 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Dec 21 19:49:35 2015 +0000

----------------------------------------------------------------------
 core/sql/ustat/hs_cli.cpp | 51 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8a2085f2/core/sql/ustat/hs_cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_cli.cpp b/core/sql/ustat/hs_cli.cpp
index ed10d97..2a2cfce 100644
--- a/core/sql/ustat/hs_cli.cpp
+++ b/core/sql/ustat/hs_cli.cpp
@@ -112,6 +112,49 @@ private:
 #pragma warn(770)  // warning elimination
 
 // -----------------------------------------------------------------------
+// DESCRIPTION: Call SQL CLI to execute a SQL statement. The caller is
+//          responsible for all error checking and recovery.
+// INPUTS:  stmt = statement descriptor for the SQL query
+//          srcDesc = source descriptor pointing to the 
+//               text string of SQL query.
+//          doPrintPlan = if true, the plan for the query will be
+//                printed after the statement is prepared but before
+//                execution; if false we do a single CLI ExecDirect call
+// -----------------------------------------------------------------------
+
+Lng32 HSExecDirect( SQLSTMT_ID * stmt
+                  , SQLDESC_ID * srcDesc
+                  , NABoolean doPrintPlan
+                  )
+{
+  Lng32 retcode = 0;
+
+  if (doPrintPlan)
+    {
+      retcode = SQL_EXEC_Prepare(stmt, srcDesc);
+      if (retcode >= 0) // ignore warnings
+        {
+          if (doPrintPlan)
+            {
+              HSLogMan *LM = HSLogMan::Instance();
+              if (LM->LogNeeded()) 
+                {
+                  printPlan(stmt);
+                }
+            } 
+          retcode = SQL_EXEC_ExecFetch(stmt,0,0);
+        }
+    }
+  else
+    {
+      retcode = SQL_EXEC_ExecDirect(stmt, srcDesc, 0, 0);
+    }
+
+  return retcode;
+}
+
+
+// -----------------------------------------------------------------------
 // DESCRIPTION: Execute a standalone dml/ddl statement.
 // INPUTS:  dml = text string of SQL query.
 //          sqlcode = the error to issue upon failure, or HS_WARNING if
@@ -227,7 +270,7 @@ Lng32 HSFuncExecQuery( const char *dml
   if (!doRetry)
   {
     // execute immediate this statement
-    retcode = SQL_EXEC_ExecDirect(&stmt, &srcDesc, 0, 0);
+    retcode = HSExecDirect(&stmt, &srcDesc, srcTabRowCount != 0);
     // If retcode is > 0 or sqlcode is HS_WARNING, then set to 0 (no error/ignore).
     if (retcode >= 0) retcode = 0;
     // If sqlcode is HS_WARNING, then this means failures should be returned as
@@ -258,7 +301,7 @@ Lng32 HSFuncExecQuery( const char *dml
       }
 
       // execute immediate this statement
-      retcode = SQL_EXEC_ExecDirect(&stmt, &srcDesc, 0, 0);
+      retcode = HSExecDirect(&stmt, &srcDesc, srcTabRowCount != 0);
 
       // filter retcode for HSHandleError
       HSFilterWarning(retcode);
@@ -319,10 +362,6 @@ Lng32 HSFuncExecQuery( const char *dml
       if (srcTabRowCount)
       {
         getRowCountFromStats(srcTabRowCount, tabDef) ;
-        // printing plan for insert...selects
-        if (LM->LogNeeded()) {
-          printPlan(&stmt) ;
-        }
       }
     }
   return retcode;


[2/2] incubator-trafodion git commit: Merge [TRAFODION-1714] PR 238 Dump query plan before execution in ULOG

Posted by db...@apache.org.
Merge [TRAFODION-1714] PR 238 Dump query plan before execution in ULOG


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

Branch: refs/heads/master
Commit: 1f9b52a63b481ed08ccb2a018cad51d6312be272
Parents: 55a5d00 8a2085f
Author: Dave Birdsall <db...@apache.org>
Authored: Tue Dec 22 16:17:42 2015 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Tue Dec 22 16:17:42 2015 +0000

----------------------------------------------------------------------
 core/sql/ustat/hs_cli.cpp | 51 +++++++++++++++++++++++++++++++++++++-----
 1 file changed, 45 insertions(+), 6 deletions(-)
----------------------------------------------------------------------