trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hzel...@apache.org
Subject [01/11] incubator-trafodion git commit: [TRAFODION-2317] Infrastructure for common subexpressions
Date Mon, 31 Oct 2016 22:55:08 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 07a77b8cd -> 1b6dfef74


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/regress/seabase/EXPECTED016
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED016 b/core/sql/regress/seabase/EXPECTED016
index b2f0610..92cd378 100644
--- a/core/sql/regress/seabase/EXPECTED016
+++ b/core/sql/regress/seabase/EXPECTED016
@@ -262,8 +262,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART7.A,
                              TRAFODION.HBASE.MCSTATPART7.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1
@@ -410,8 +408,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART5.A,
                              TRAFODION.HBASE.MCSTATPART5.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1
@@ -558,8 +554,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART3.A,
                              TRAFODION.HBASE.MCSTATPART3.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1
@@ -706,8 +700,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART6.A,
                              TRAFODION.HBASE.MCSTATPART6.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1
@@ -854,8 +846,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART2.A,
                              TRAFODION.HBASE.MCSTATPART2.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1
@@ -1002,8 +992,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART1.A,
                              TRAFODION.HBASE.MCSTATPART1.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1
@@ -1150,8 +1138,6 @@ DESCRIPTION
   child_partitioning_func  hash2 partitioned 4 ways on
                              (TRAFODION.HBASE.MCSTATPART8.A,
                              TRAFODION.HBASE.MCSTATPART8.B)
-  seamonster_query ....... no
-  seamonster_exchange .... no
 
 
 HASH_PARTIAL_GROUPBY_LEAF =================  SEQ_NO 2        ONLY CHILD 1

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/regress/seabase/EXPECTED018
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED018 b/core/sql/regress/seabase/EXPECTED018
index 5c87f10..e6014c0 100644
--- a/core/sql/regress/seabase/EXPECTED018
+++ b/core/sql/regress/seabase/EXPECTED018
@@ -51,7 +51,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 5    .    6    sort_partial_aggr_ro                                  1.00E+000
 4    .    5    esp_exchange                    1:2(hash2)            1.00E+000
 3    .    4    sort_partial_aggr_le                                  1.00E+000
-2    1    3    hybrid_hash_join                                      5.00E+012
+2    1    3    hybrid_hash_join      u                               5.00E+012
 .    .    2    trafodion_scan                  T018_LINEITEM         1.00E+007
 .    .    1    trafodion_scan                  T018_ORDERS           1.00E+006
 
@@ -77,7 +77,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 6    .    7    sort_partial_aggr_ro                                  1.00E+000
 5    .    6    esp_exchange                    1:2(range)            1.00E+000
 4    .    5    sort_partial_aggr_le                                  1.00E+000
-3    2    4    hybrid_hash_join                                      5.00E+012
+3    2    4    hybrid_hash_join      u                               5.00E+012
 .    .    3    trafodion_scan                  T018_LINEITEM         1.00E+007
 1    .    2    esp_exchange                    2(rep-b):2(range)     1.00E+006
 .    .    1    trafodion_scan                  T018_ORDERS           1.00E+006
@@ -135,7 +135,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 7    .    8    sort_partial_aggr_ro                                  1.00E+000
 6    .    7    esp_exchange                    1:98(hash2)           1.00E+000
 5    .    6    sort_partial_aggr_le                                  1.00E+000
-4    2    5    hybrid_hash_join                                      5.00E+012
+4    2    5    hybrid_hash_join      u                               5.00E+012
 3    .    4    esp_exchange                    98(hash2):4(hash2)    1.00E+007
 .    .    3    trafodion_scan                  T018_LINEITEM         1.00E+007
 1    .    2    esp_exchange                    98(hash2):4(hash2)    1.00E+006

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/regress/tools/runregr_compGeneral.ksh
----------------------------------------------------------------------
diff --git a/core/sql/regress/tools/runregr_compGeneral.ksh b/core/sql/regress/tools/runregr_compGeneral.ksh
index 39943d8..e8f0cbf 100755
--- a/core/sql/regress/tools/runregr_compGeneral.ksh
+++ b/core/sql/regress/tools/runregr_compGeneral.ksh
@@ -226,7 +226,7 @@ fi
 
 # sbtestfiles contains the list of tests to be run in seabase mode
 if [ "$seabase" -ne 0 ]; then
-  sbtestfiles="TEST001 TEST004 TEST005 TEST006 TEST011 TEST012 TEST013 TEST015 TEST023 TEST071
TEST042 TEST043 TESTTOK TESTTOK2 TEST062"
+  sbtestfiles="TEST001 TEST004 TEST005 TEST006 TEST011 TEST012 TEST013 TEST015 TEST023 TEST071
TEST042 TEST043 TEST045 TESTTOK TESTTOK2 TEST062"
   sbprettyfiles=
   for i in $prettyfiles; do
     for j in $sbtestfiles; do

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/sqlcomp/CmpDescribe.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp
index 531cf3a..5ca0309 100644
--- a/core/sql/sqlcomp/CmpDescribe.cpp
+++ b/core/sql/sqlcomp/CmpDescribe.cpp
@@ -2284,9 +2284,9 @@ short CmpDescribeHiveTable (
       
       NAString nas;
       if (type == 1)
-        ((NAType*)nat)->getMyTypeAsText(&nas, FALSE);
+        nat->getMyTypeAsText(&nas, FALSE);
       else
-        ((NAType*)nat)->getMyTypeAsHiveText(&nas);
+        nat->getMyTypeAsHiveText(&nas);
       
       sprintf(&buf[strlen(buf)], "%s", nas.data());
 
@@ -2442,7 +2442,7 @@ short cmpDisplayColumn(const NAColumn *nac,
   const NAType * nat = (inNAT ? inNAT : nac->getType());
   
   NAString nas;
-  ((NAType*)nat)->getMyTypeAsText(&nas, FALSE);
+  nat->getMyTypeAsText(&nas, FALSE);
   
   NAString attrStr;
   

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/sqlcomp/CmpMain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpMain.cpp b/core/sql/sqlcomp/CmpMain.cpp
index cf1d8fc..24f72dc 100644
--- a/core/sql/sqlcomp/CmpMain.cpp
+++ b/core/sql/sqlcomp/CmpMain.cpp
@@ -864,6 +864,8 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(QueryText& input,         
  //IN
        Retried_for_priv_failure = TRUE;
     }
 
+    CmpCommon::statement()->prepareForCompilationRetry();
+
     // We will retry Compilation, so toss pre-retry errors/warnings
     CmpCommon::diags()->rewind(here, TRUE/*update maxDiagsId_*/);
     if (queryExpr) {
@@ -1668,7 +1670,7 @@ CmpMain::ReturnStatus CmpMain::sqlcomp(const char *input_str,      
    //IN
                                        NABoolean* cacheable,            //OUT
                                        TimeVal* begTime,                //IN
                                        NABoolean shouldLog)             //IN
-{
+{                               // 
   CmpExceptionEnvWatcher guard;
 
   ComDiagsArea & d = *CmpCommon::diags();
@@ -2431,7 +2433,7 @@ 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.isNonCacheableMVQRplan()) {
+            if (!generator.isNonCacheablePlan()) {
               tkey = 
                 cachewa.getTextKey(input_str, charset, getStmtAttributes());
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 9ff2f54..5a707c2 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -1941,8 +1941,10 @@ short CmpSeabaseDDL::createSeabaseTable2(
                 }
               catch (...)
                 {
-                  // diags area should be set
-                  CMPASSERT(CmpCommon::diags()->getNumber(DgSqlCode::ERROR_) > 0);
+                  // diags area should be set, if not, set it
+                  if (CmpCommon::diags()->getNumber(DgSqlCode::ERROR_) == 0)
+                    *CmpCommon::diags() << DgSqlCode(-4243)
+                              << DgString0("(expression with unknown type)");
                   exceptionOccurred = TRUE;
                 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index 3ac1334..971ef24 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3854,6 +3854,15 @@ enum DefaultConstants
   // controls if sim check is to be done and where (root or leaf)
   TRAF_SIMILARITY_CHECK,
 
+  // Common subexpressions in RelExpr trees
+  CSE_DEBUG_WARNINGS,
+  CSE_FOR_WITH,
+  CSE_USE_TEMP,
+  CSE_HIVE_TEMP_TABLE,
+  CSE_PRINT_DEBUG_INFO,
+  CSE_CLEANUP_HIVE_TABLES,
+  CSE_CACHE_TEMP_QUERIES,
+
   // This enum constant must be the LAST one in the list; it's a count,
   // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
   __NUM_DEFAULT_ATTRIBUTES

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 88a8117..0117ac6 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -1144,7 +1144,23 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
  DDkwd__(CREATE_METADATA_TABLE,                "OFF"),
  DDkwd__(CREATE_OBJECTS_IN_METADATA_ONLY,      "OFF"),
 
- DDkwd__(CROSS_PRODUCT_CONTROL,		"ON"),
+ DDkwd__(CROSS_PRODUCT_CONTROL,	               "ON"),
+
+ // CQDs for Common Subexpressions (CSEs)
+ // cache queries containing temp tables for common subexpressions
+ DDkwd__(CSE_CACHE_TEMP_QUERIES,               "OFF"),
+ // "cleanup obsolete volatile tables" command cleans up Hive temp tables
+ DDkwd__(CSE_CLEANUP_HIVE_TABLES,              "OFF"),
+ // emit warnings that help diagnose why CSEs are not shared
+ DDkwd__(CSE_DEBUG_WARNINGS,                   "OFF"),
+ // create a CommonSubExpr node for CTEs defined in WITH clauses (OFF/ON)
+ DDkwd__(CSE_FOR_WITH,                         "OFF"),
+ // use Hive tables as temp tables
+ DDkwd__(CSE_HIVE_TEMP_TABLE,                  "ON"),
+ // print debugging info on stdout
+ DDkwd__(CSE_PRINT_DEBUG_INFO,                 "OFF"),
+ // implement CommonSubExpr as a temp table (OFF/SYSTEM/ON)
+ DDkwd__(CSE_USE_TEMP,                         "ON"),
 
 SDDui___(CYCLIC_ESP_PLACEMENT,                  "1"),
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b90dc334/core/sql/sqlcomp/parser.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/parser.cpp b/core/sql/sqlcomp/parser.cpp
index 9f2a1c8..4b032d4 100644
--- a/core/sql/sqlcomp/parser.cpp
+++ b/core/sql/sqlcomp/parser.cpp
@@ -99,6 +99,9 @@ void Parser::reset(NABoolean on_entry_reset_was_needed)
   //
   if (!Get_SqlParser_Flags(DELAYED_RESET))
     Set_SqlParser_Flags(0);
+
+  if (with_clauses_)
+    with_clauses_->clear();
 }
 
 ULng32 cmmHashFunc_NAString(const NAString& str)


Mime
View raw message