trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2605] Rework of fix for TRAFODION-2294
Date Fri, 19 May 2017 21:33:53 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master ced104a79 -> 3f1485fe6


[TRAFODION-2605] Rework of fix for TRAFODION-2294


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

Branch: refs/heads/master
Commit: 1caf7f227ea42ed0d21ddc2308851145fd428ad2
Parents: 113c4de
Author: Dave Birdsall <dbirdsall@apache.org>
Authored: Thu May 18 19:59:51 2017 +0000
Committer: Dave Birdsall <dbirdsall@apache.org>
Committed: Thu May 18 19:59:51 2017 +0000

----------------------------------------------------------------------
 core/sql/arkcmp/CmpStatement.cpp        |  2 +-
 core/sql/regress/executor/DIFF140.KNOWN |  4 --
 core/sql/regress/executor/EXPECTED140   | 63 ++++++++++++++--------------
 core/sql/sqlcomp/CmpMain.cpp            | 47 ++++++++++-----------
 core/sql/sqlcomp/CmpMain.h              | 12 ++++--
 5 files changed, 62 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1caf7f22/core/sql/arkcmp/CmpStatement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/arkcmp/CmpStatement.cpp b/core/sql/arkcmp/CmpStatement.cpp
index ac8bc9a..a23891d 100644
--- a/core/sql/arkcmp/CmpStatement.cpp
+++ b/core/sql/arkcmp/CmpStatement.cpp
@@ -504,7 +504,7 @@ CmpStatement::process (const CmpMessageSQLText& sqltext)
     cmpmain.sqlcomp(qText, 0, 
 		    &(reply_->data()), &(reply_->size()),
 		    reply_->outHeap(), CmpMain::END, 
-		    &fragmentDir, typ, !doNotCachePlan);
+		    &fragmentDir, typ, doNotCachePlan ? CmpMain::EXPLAIN : CmpMain::NORMAL);
   }
   catch (...)
   {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1caf7f22/core/sql/regress/executor/DIFF140.KNOWN
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/DIFF140.KNOWN b/core/sql/regress/executor/DIFF140.KNOWN
deleted file mode 100644
index a1a2f29..0000000
--- a/core/sql/regress/executor/DIFF140.KNOWN
+++ /dev/null
@@ -1,4 +0,0 @@
-442d441
-<  input_variables ........ %(200)
-642d640
-<  input_variables ........ %(201)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1caf7f22/core/sql/regress/executor/EXPECTED140
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED140 b/core/sql/regress/executor/EXPECTED140
index 0039e49..9e508a5 100644
--- a/core/sql/regress/executor/EXPECTED140
+++ b/core/sql/regress/executor/EXPECTED140
@@ -124,18 +124,18 @@
 +>  , SS_NET_PROFIT     
 +>from hive.hive.store_sales where ss_sold_date_sk is not null;
 Task:  LOAD            Status: Started    Object: TRAFODION.SCH.T140C
-Task:  CLEANUP         Status: Started    Time: 2017-02-05 01:40:08.961
-Task:  CLEANUP         Status: Ended      Time: 2017-02-05 01:40:08.981
-Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.020
-Task:  LOADING DATA    Status: Started    Time: 2017-02-05 01:40:08.981
+Task:  CLEANUP         Status: Started    Time: 2017-05-18 19:50:17.884
+Task:  CLEANUP         Status: Ended      Time: 2017-05-18 19:50:17.906
+Task:  CLEANUP         Status: Ended      Elapsed Time:    00:00:00.022
+Task:  LOADING DATA    Status: Started    Time: 2017-05-18 19:50:17.906
        Rows Processed: 2750311 
        Error Rows:     0 
-Task:  LOADING DATA    Status: Ended      Time: 2017-02-05 01:41:00.169
-Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:51.188
-Task:  COMPLETION      Status: Started    Time: 2017-02-05 01:41:00.169
+Task:  LOADING DATA    Status: Ended      Time: 2017-05-18 19:50:57.493
+Task:  LOADING DATA    Status: Ended      Elapsed Time:    00:00:39.586
+Task:  COMPLETION      Status: Started    Time: 2017-05-18 19:50:57.493
        Rows Loaded:    2750311 
-Task:  COMPLETION      Status: Ended      Time: 2017-02-05 01:41:04.557
-Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:04.389
+Task:  COMPLETION      Status: Ended      Time: 2017-05-18 19:50:59.480
+Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:01.987
 
 --- 2750311 row(s) loaded.
 >>update statistics for table t140c on every column sample;
@@ -156,7 +156,7 @@ Task:  COMPLETION      Status: Ended      Elapsed Time:    00:00:04.389
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018896818344
+PLAN_ID .................. 212361897088994366
 ROWS_OUT ................ 33
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select a from t140 where b>500;
@@ -194,7 +194,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.A
 
 
@@ -242,7 +242,7 @@ A
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018897196230
+PLAN_ID .................. 212361897089356492
 ROWS_OUT ................ 33
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an from t140b where b<=200;
@@ -280,7 +280,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111582
+  ObjectUIDs ............. 3998763283695617402
   select_list ............ TRAFODION.SCH.T140B.AN
 
 
@@ -315,7 +315,7 @@ DESCRIPTION
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018897383558
+PLAN_ID .................. 212361897089555947
 ROWS_OUT ................ 33
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an from t140 where b<=200;
@@ -353,7 +353,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.AN
 
 
@@ -399,7 +399,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018897576677
+PLAN_ID .................. 212361897089760158
 ROWS_OUT ................ 10
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an from t140 where b=200 and an is not null;
@@ -437,7 +437,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.AN
   input_variables ........ %(200)
 
@@ -481,7 +481,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018897781591
+PLAN_ID .................. 212361897089997296
 ROWS_OUT ................ 67
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an, a from t140 where b!=500;
@@ -519,7 +519,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.AN, TRAFODION.SCH.T140.A
 
 
@@ -599,7 +599,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018898069979
+PLAN_ID .................. 212361897090271231
 ROWS_OUT ................ 10
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an from t140 where bn=201 and an is not null;
@@ -637,7 +637,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.AN
   input_variables ........ %(201)
 
@@ -680,7 +680,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018898270061
+PLAN_ID .................. 212361897090489336
 ROWS_OUT ................ 67
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an, a from t140 where bn!=501;
@@ -718,7 +718,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.AN, TRAFODION.SCH.T140.A
 
 
@@ -813,7 +813,7 @@ A
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018898546250
+PLAN_ID .................. 212361897090784717
 ROWS_OUT ................ 11
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select an from t140 where an between 20 and 40;
@@ -851,7 +851,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   TRAF_ALIGNED_ROW_FORMAT  OFF
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111338
+  ObjectUIDs ............. 3998763283695617040
   select_list ............ TRAFODION.SCH.T140.AN
 
 
@@ -918,7 +918,7 @@ AN
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018898817447
+PLAN_ID .................. 212361897091104921
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select avg(a) from t140b;
@@ -958,7 +958,7 @@ DESCRIPTION
   PARALLEL_NUM_ESPS ...... 1
   HBASE_DOP_PARALLEL_SCAN  2
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111582
+  ObjectUIDs ............. 3998763283695617402
   select_list ............ cast(cast((cast((cast((cast(sum(TRAFODION.SCH.T140B.
                              A)) * 10000 ...0)) / cast(count(1 )))) / 10000
                              ...0)))
@@ -1018,7 +1018,7 @@ DESCRIPTION
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018899076823
+PLAN_ID .................. 212361897091443690
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select avg(a) from t140b;
@@ -1058,7 +1058,7 @@ DESCRIPTION
   PARALLEL_NUM_ESPS ...... 1
   HBASE_DOP_PARALLEL_SCAN  1
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111582
+  ObjectUIDs ............. 3998763283695617402
   select_list ............ cast(cast((cast((cast((cast(sum(TRAFODION.SCH.T140B.
                              A)) * 10000 ...0)) / cast(count(1 )))) / 10000
                              ...0)))
@@ -1114,7 +1114,7 @@ DESCRIPTION
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212353018899076823
+PLAN_ID .................. 212361897091569821
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select avg(a) from t140b;
@@ -1153,8 +1153,7 @@ DESCRIPTION
   HBASE_SMALL_SCANNER .... OFF
   PARALLEL_NUM_ESPS ...... 1
   HBASE_DOP_PARALLEL_SCAN  1
-  GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 6461097501759111582
+  ObjectUIDs ............. 3998763283695617402
   select_list ............ cast(cast((cast((cast((cast(sum(TRAFODION.SCH.T140B.
                              A)) * 10000 ...0)) / cast(count(1 )))) / 10000
                              ...0)))

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1caf7f22/core/sql/sqlcomp/CmpMain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpMain.cpp b/core/sql/sqlcomp/CmpMain.cpp
index ce75d82..bef69f4 100644
--- a/core/sql/sqlcomp/CmpMain.cpp
+++ b/core/sql/sqlcomp/CmpMain.cpp
@@ -638,7 +638,7 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(QueryText& input,         
  //IN
                                        CompilerPhase phase,         //IN
                                        FragmentDir **fragmentDir,   //OUT
                                        IpcMessageObjType op,        //IN
-                                       NABoolean useQueryCache)     //IN
+                                       QueryCachingOption useQueryCache) //IN
 {
   TimeVal begTime;
   GETTIMEOFDAY(&begTime, 0);
@@ -702,7 +702,7 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(QueryText& input,         
  //IN
   // if running in OSIM capture mode or simulation, don't use the cache
   if (OSIM_runningInCaptureMode()||OSIM_runningSimulation())
   {
-    useQueryCache = FALSE;
+    useQueryCache = NOCACHE;
     useTextCache = FALSE;
   }
 
@@ -768,12 +768,8 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(QueryText& input,        
   //IN
     //metadata from disk.
     CmpCommon::context()->schemaDB_->getNATableDB()->useCache();
 
-    //The following two statements reset the parser flag
-    //when we are re-trying compilation.
-    //set parser flags to 0, to cleanup the parser flags
-    Set_SqlParser_Flags(0);
     //set the parser flags to the original value.
-    Set_SqlParser_Flags(originalParserFlags);
+    Assign_SqlParser_Flags(originalParserFlags);
 
     //if using special tables e.g. using index as base table
     //select * from table (index_table T018ibc);
@@ -839,7 +835,7 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(QueryText& input,         
  //IN
       if ( cacheable )
       {
          // retry any error (once) if query was cacheable
-         useQueryCache = FALSE; // retry with caching off
+         useQueryCache = NOCACHE; // retry with caching off
          Retried_without_QC = TRUE;
          Retried_for_priv_failure = FALSE;
          CURRENTQCACHE->incNOfRetries(); // count retries
@@ -944,7 +940,8 @@ CmpMain::ReturnStatus CmpMain::sqlcompStatic
 
   // make at most 2 tries to compile a query: 1st with caching on, and
   // on any error, retry it with caching off if query was cacheable
-  NABoolean useQueryCache=TRUE, cacheable=FALSE, useTextCache=TRUE;
+  QueryCachingOption useQueryCache = NORMAL;
+  NABoolean cacheable=FALSE, useTextCache=TRUE;
 
   Lng32 here = CmpCommon::diags()->mark();
   CmpMain::ReturnStatus rc = PARSERERROR;
@@ -993,12 +990,8 @@ CmpMain::ReturnStatus CmpMain::sqlcompStatic
       }
     }
 
-    //The following two statements reset the parser flag
-    //when we are re-trying compilation.
-    //set parser flags to 0, to cleanup the parser flags
-    Set_SqlParser_Flags(0);
     //set the parser flags to the original value.
-    Set_SqlParser_Flags(originalParserFlags);
+    Assign_SqlParser_Flags(originalParserFlags);
 
     CmpCommon::context()->SetMode(STMT_STATIC);
     MonitorMemoryUsage_Enter("Parser");
@@ -1065,7 +1058,7 @@ CmpMain::ReturnStatus CmpMain::sqlcompStatic
     CmpCommon::context()->SetMode(mode);
     if (rc != SUCCESS && x==0 && cacheable) {
       // retry any error (once) if query was cacheable
-      useQueryCache = FALSE; // retry with caching off
+      useQueryCache = NOCACHE; // retry with caching off
       // toss pre-retry errors/warnings
       CmpCommon::diags()->rewind(here, TRUE/*update maxDiagsId_*/);
       CURRENTQCACHE->incNOfRetries(); // count retries
@@ -1679,7 +1672,7 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(const char *input_str,      
    //IN
                                        CompilerPhase phase,             //IN
 				       FragmentDir **fragmentDir,       //OUT
                                        IpcMessageObjType op,            //IN
-                                       NABoolean useQueryCache,         //IN
+                                       QueryCachingOption useQueryCache, //IN
                                        NABoolean* cacheable,            //OUT
                                        TimeVal* begTime,                //IN
                                        NABoolean shouldLog)             //IN
@@ -1837,7 +1830,7 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str,      
    //IN
                                        CompilerPhase phase,             //IN
 				       FragmentDir **fragmentDir,       //OUT
                                        IpcMessageObjType op,            //IN
-                                       NABoolean useQueryCache,         //IN
+                                       QueryCachingOption useQueryCache, //IN
                                        NABoolean* cacheable,            //OUT
                                        TimeVal* begTime,                //IN
                                        NABoolean shouldLog)             //IN
@@ -1869,13 +1862,13 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str,    
      //IN
   BindWA bindWA(ActiveSchemaDB(), CmpCommon::context());
 
 
-  if (useQueryCache && CmpCommon::getDefault(NSK_DBG) == DF_ON) {
-    useQueryCache = FALSE; // LCOV_EXCL_LINE   
+  if (useQueryCache != NOCACHE && CmpCommon::getDefault(NSK_DBG) == DF_ON) {
+    useQueryCache = NOCACHE; // LCOV_EXCL_LINE   
   }
 
   // Every compile goes through here so we are guranteed that the
   //doNotAbort gloabal flag is reset appropriately for each statement.
-  CmpCommon::context()->setDoNotAbort(useQueryCache);
+  CmpCommon::context()->setDoNotAbort(useQueryCache != NOCACHE);
 
   //if this is a secondary MXCMP set NATable Caching OFF
   if(CmpCommon::context()->isSecondaryMxcmp())
@@ -1915,7 +1908,7 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str,      
    //IN
 
 
   NABoolean bPatchOK=FALSE;
-  if (useQueryCache && phase == END) {
+  if (useQueryCache == NORMAL && phase == END) {
     cachewa.setPhase(PARSE);
     TaskMonitor hqcCmpBackPatch;
     hqcCmpBackPatch.enter();
@@ -2131,21 +2124,21 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str,    
      //IN
     }
 
 #ifdef NA_DEBUG_GUI
-  if (useQueryCache && ((RelRoot *)queryExpr)->getDisplayTree()
+  if (useQueryCache == NORMAL && ((RelRoot *)queryExpr)->getDisplayTree()
       && CmpMain::pExpFuncs_
       ) {
   }
 #endif
 
-  if (useQueryCache && CmpCommon::getDefault(NSK_DBG) == DF_ON) {
-    useQueryCache = FALSE;
+  if (useQueryCache != NOCACHE && CmpCommon::getDefault(NSK_DBG) == DF_ON) {
+    useQueryCache = NOCACHE;
   }
 
   // -------------------------------------------------------------------
   // try to compile query via (after BIND stage) cache hit
   // -------------------------------------------------------------------
   if (!CURRENTQCACHE->getHQC()->isPlanNoAQROrHiveAccess()
-      && useQueryCache && phase == END) {
+      && useQueryCache != NOCACHE && phase == END) {
     cachewa.setPhase(BIND);
     TaskMonitor hqcCmpBackPatch;
     hqcCmpBackPatch.enter();
@@ -2461,7 +2454,9 @@ CmpMain::ReturnStatus CmpMain::compile(const char *input_str,      
    //IN
             //    has a parameterized equality predicate then
             // do NOT cache it because it can result in a false hit
             // that can cause wrong results
-            if (!generator.isNonCacheablePlan()) {
+            // do NOT cache it if this is for EXPLAIN (useQueryCache == EXPLAIN)
+            // to avoid security holes
+            if ((!generator.isNonCacheablePlan()) && (useQueryCache == NORMAL)) {
               tkey = 
                 cachewa.getTextKey(input_str, charset, getStmtAttributes());
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1caf7f22/core/sql/sqlcomp/CmpMain.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpMain.h b/core/sql/sqlcomp/CmpMain.h
index 32659e0..52602cd 100644
--- a/core/sql/sqlcomp/CmpMain.h
+++ b/core/sql/sqlcomp/CmpMain.h
@@ -149,6 +149,12 @@ public:
   { PREPARSE, PARSE, BIND, TRANSFORM, NORMALIZE, SEMANTIC_OPTIMIZE, ANALYSIS,
     OPTIMIZE, PRECODEGEN, GENERATOR, END };
 
+  enum QueryCachingOption
+  { NORMAL   // normal operation, attempt to generate cacheable plan and cache it
+  , EXPLAIN  // attempt to generate a cacheable plan but do not cache it
+  , NOCACHE  // do not attempt a cacheable plan, and do not cache it
+  };
+
   CmpMain();
   virtual ~CmpMain() {} // LCOV_EXCL_LINE  
 
@@ -173,7 +179,7 @@ public:
                         CompilerPhase = END,
 			FragmentDir **framentDir = NULL,
                         IpcMessageObjType op=CmpMessageObj::SQLTEXT_COMPILE,
-                        NABoolean useQueryCache=TRUE);
+                        QueryCachingOption useQueryCache=NORMAL);
 
   // sqlcomp will compile a RelExpr into code from generator
   ReturnStatus sqlcomp (const char *input_str, Lng32 charset,
@@ -183,7 +189,7 @@ public:
 			CompilerPhase p= END,
 			FragmentDir **fragmentDir = NULL,
                         IpcMessageObjType op=CmpMessageObj::SQLTEXT_COMPILE,
-                        NABoolean useQueryCache=FALSE,
+                        QueryCachingOption useQueryCache=NOCACHE,
                         NABoolean* cacheable=NULL,
                         TimeVal* begTime=NULL,
                         NABoolean shouldLog=FALSE);
@@ -261,7 +267,7 @@ private:
 		       CompilerPhase p,
 		       FragmentDir **fragmentDir,
 		       IpcMessageObjType op,
-		       NABoolean useQueryCache,
+		       QueryCachingOption useQueryCache,
 		       NABoolean* cacheable,
 		       TimeVal* begTime,
                        NABoolean shouldLog);


Mime
View raw message