trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/3] incubator-trafodion git commit: [TRAFODION-2635] Fix two bugs concerning HBASE CELL access on Traf objects
Date Sat, 10 Jun 2017 04:26:15 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master dbd078c15 -> ccb568462


[TRAFODION-2635] Fix two bugs concerning HBASE CELL access on Traf objects


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

Branch: refs/heads/master
Commit: 8d9c1d173d77adfa0fc274dac6b9ce89dc1aae51
Parents: 52cca83
Author: Dave Birdsall <dbirdsall@apache.org>
Authored: Wed Jun 7 22:53:38 2017 +0000
Committer: Dave Birdsall <dbirdsall@apache.org>
Committed: Wed Jun 7 22:53:38 2017 +0000

----------------------------------------------------------------------
 core/sql/common/NAMemory.h              |  3 ++
 core/sql/generator/GenRelExeUtil.cpp    |  7 +++
 core/sql/generator/GenRelMisc.cpp       |  2 +
 core/sql/generator/GenRelScan.cpp       |  7 ++-
 core/sql/generator/GenUdr.cpp           |  1 +
 core/sql/generator/Generator.cpp        | 73 ++++++++++++++++++----------
 core/sql/generator/Generator.h          | 20 ++++----
 core/sql/optimizer/NATable.cpp          |  4 +-
 core/sql/optimizer/RelScan.h            |  3 +-
 core/sql/optimizer/ValueDesc.cpp        |  5 +-
 core/sql/sqlcat/TrafDDLdesc.cpp         |  2 +-
 core/sql/sqlcat/TrafDDLdesc.h           | 67 +++++++++++++++++--------
 core/sql/sqlcat/readRealArk.cpp         |  2 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp |  4 ++
 14 files changed, 137 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/common/NAMemory.h
----------------------------------------------------------------------
diff --git a/core/sql/common/NAMemory.h b/core/sql/common/NAMemory.h
index 270289e..52b7109 100644
--- a/core/sql/common/NAMemory.h
+++ b/core/sql/common/NAMemory.h
@@ -473,6 +473,9 @@ NA_EIDPROC
   NABoolean  getSharedMemory() { return sharedMemory_; }
   void setSharedMemory() { sharedMemory_ = TRUE; }
 #endif
+
+  NABoolean isComSpace(void) { return derivedClass_ == COMSPACE_CLASS; } ;
+
 protected:
 
   // set the name of this memory

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/generator/GenRelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index 1a5dda3..9435bd8 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -284,6 +284,7 @@ TrafDesc *ExeUtilExpr::createVirtualTableDesc()
 {
   TrafDesc * table_desc =
     Generator::createVirtualTableDesc(getVirtualTableName(),
+				      NULL, // let it decide what heap to use
 				      ComTdbExeUtil::getVirtTableNumCols(),
 				      ComTdbExeUtil::getVirtTableColumnInfo(),
 				      ComTdbExeUtil::getVirtTableNumKeys(),
@@ -316,6 +317,7 @@ TrafDesc *ExeUtilDisplayExplain::createVirtualTableDesc()
   TrafDesc * table_desc = 
     Generator::createVirtualTableDesc
     (getVirtualTableName(),
+     NULL, // let it decide what heap to use
      ComTdbExeUtilDisplayExplain::getVirtTableNumCols(),
      vtci,
      ComTdbExeUtil::getVirtTableNumKeys(),
@@ -1225,6 +1227,7 @@ TrafDesc *ExeUtilGetUID::createVirtualTableDesc()
 {
   TrafDesc * table_desc =
     Generator::createVirtualTableDesc(getVirtualTableName(),
+				      NULL, // let it decide what heap to use
 				      ComTdbExeUtilGetUID::getVirtTableNumCols(),
 				      ComTdbExeUtilGetUID::getVirtTableColumnInfo(),
 				      ComTdbExeUtilGetUID::getVirtTableNumKeys(),
@@ -1303,6 +1306,7 @@ TrafDesc *ExeUtilGetQID::createVirtualTableDesc()
 {
   TrafDesc * table_desc =
     Generator::createVirtualTableDesc(getVirtualTableName(),
+				      NULL, // let it decide what heap to use
 				      ComTdbExeUtilGetQID::getVirtTableNumCols(),
 				      ComTdbExeUtilGetQID::getVirtTableColumnInfo(),
 				      ComTdbExeUtilGetQID::getVirtTableNumKeys(),
@@ -3538,6 +3542,7 @@ TrafDesc *ExeUtilRegionStats::createVirtualTableDesc()
   else
     table_desc = Generator::createVirtualTableDesc(
 	 getVirtualTableName(),
+	 NULL, // let it decide what heap to use
 	 rs.getVirtTableNumCols(),
 	 rs.getVirtTableColumnInfo(),
 	 rs.getVirtTableNumKeys(),
@@ -3674,6 +3679,7 @@ TrafDesc *ExeUtilLobInfo::createVirtualTableDesc()
    if (tableFormat_)
     table_desc = Generator::createVirtualTableDesc(
 	 getVirtualTableName(),
+	 NULL, // let it decide what heap to use
 	 ComTdbExeUtilLobInfo::getVirtTableNumCols(),
 	 ComTdbExeUtilLobInfo::getVirtTableColumnInfo(),
 	 ComTdbExeUtilLobInfo::getVirtTableNumKeys(),
@@ -4673,6 +4679,7 @@ TrafDesc *HiveMDaccessFunc::createVirtualTableDesc()
   TrafDesc * table_desc =
     Generator::createVirtualTableDesc(
 				      getVirtualTableName(),
+				      NULL, // let it decide what heap to use
 				      ComTdbExeUtilHiveMDaccess::getVirtTableNumCols((char*)mdType_.data()),
 				      ComTdbExeUtilHiveMDaccess::getVirtTableColumnInfo((char*)mdType_.data()),
 				      ComTdbExeUtilHiveMDaccess::getVirtTableNumKeys((char*)mdType_.data()),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/generator/GenRelMisc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelMisc.cpp b/core/sql/generator/GenRelMisc.cpp
index c165ad7..c549054 100644
--- a/core/sql/generator/GenRelMisc.cpp
+++ b/core/sql/generator/GenRelMisc.cpp
@@ -373,6 +373,7 @@ TrafDesc *DDLExpr::createVirtualTableDesc()
     {
       table_desc = 
         Generator::createVirtualTableDesc(getVirtualTableName(),
+                                          NULL, // let it decide what heap to use
                                           ComTdbDDL::getVirtTableNumCols(),
                                           ComTdbDDL::getVirtTableColumnInfo(),
                                           ComTdbDDL::getVirtTableNumKeys(),
@@ -5107,6 +5108,7 @@ TrafDesc *StatisticsFunc::createVirtualTableDesc()
 {
   TrafDesc * table_desc =
     Generator::createVirtualTableDesc(getVirtualTableName(),
+				      NULL, // let it decide what heap to use    
 				      ComTdbStats::getVirtTableNumCols(),
 				      ComTdbStats::getVirtTableColumnInfo(),
 				      ComTdbStats::getVirtTableNumKeys(),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/generator/GenRelScan.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelScan.cpp b/core/sql/generator/GenRelScan.cpp
index e5a8788..d744fa5 100644
--- a/core/sql/generator/GenRelScan.cpp
+++ b/core/sql/generator/GenRelScan.cpp
@@ -1492,7 +1492,7 @@ void populateRangeDescForBeginKey(char* buf, Int32 len, struct TrafDesc*
target,
 }
 
 TrafDesc *HbaseAccess::createVirtualTableDesc(const char * name,
-						 NABoolean isRW, NABoolean isCW, NAArray<HbaseStr>* beginKeys)
+  NABoolean isRW, NABoolean isCW, NAArray<HbaseStr>* beginKeys, NAMemory * heap)
 {
   TrafDesc * table_desc = NULL;
 
@@ -1500,6 +1500,7 @@ TrafDesc *HbaseAccess::createVirtualTableDesc(const char * name,
     table_desc =
       Generator::createVirtualTableDesc(
 					name,
+					heap,
 					ComTdbHbaseAccess::getVirtTableRowwiseNumCols(),
 					ComTdbHbaseAccess::getVirtTableRowwiseColumnInfo(),
 					ComTdbHbaseAccess::getVirtTableRowwiseNumKeys(),
@@ -1507,6 +1508,7 @@ TrafDesc *HbaseAccess::createVirtualTableDesc(const char * name,
   else if (isCW)
     table_desc =
       Generator::createVirtualTableDesc(name,
+					heap,
 					ComTdbHbaseAccess::getVirtTableNumCols(),
 					ComTdbHbaseAccess::getVirtTableColumnInfo(),
 					ComTdbHbaseAccess::getVirtTableNumKeys(),
@@ -1514,7 +1516,7 @@ TrafDesc *HbaseAccess::createVirtualTableDesc(const char * name,
 
   if (table_desc)
     {
-      struct TrafDesc* head = Generator::assembleDescs(beginKeys, NULL, NULL);
+      struct TrafDesc* head = Generator::assembleDescs(beginKeys, heap);
 
       table_desc->tableDesc()->hbase_regionkey_desc = head;
 
@@ -1668,6 +1670,7 @@ TrafDesc *HbaseAccess::createVirtualTableDesc(const char * name,
 
    table_desc =
       Generator::createVirtualTableDesc(name,
+					NULL, // let it decide what heap to use
 					numCols, //ComTdbHbaseAccess::getVirtTableNumCols(),
 					colInfoArray, //ComTdbHbaseAccess::getVirtTableColumnInfo(),
 					numKeys, //ComTdbHbaseAccess::getVirtTableNumKeys(),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/generator/GenUdr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenUdr.cpp b/core/sql/generator/GenUdr.cpp
index baffd54..eb9c926 100644
--- a/core/sql/generator/GenUdr.cpp
+++ b/core/sql/generator/GenUdr.cpp
@@ -1924,6 +1924,7 @@ TrafDesc *TableMappingUDF::createVirtualTableDesc()
   }
   TrafDesc * table_desc =
     Generator::createVirtualTableDesc(getRoutineName().getQualifiedNameAsString().data(),
+                                      NULL, // let it decide what heap to use
                                       numOutputCols,
 				      outColsInfo,
 				      0,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/generator/Generator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/Generator.cpp b/core/sql/generator/Generator.cpp
index eb054e0..d39d23e 100644
--- a/core/sql/generator/Generator.cpp
+++ b/core/sql/generator/Generator.cpp
@@ -1504,7 +1504,7 @@ TrafDesc* Generator::createColDescs(
   ComTdbVirtTableColumnInfo * columnInfo,
   Int16 numCols,
   UInt32 &offset,
-  Space * space)
+  NAMemory * space)
 {
   if (! columnInfo)
     return NULL;
@@ -1653,8 +1653,8 @@ TrafDesc* Generator::createColDescs(
 }
 
 static void initKeyDescStruct(TrafKeysDesc * tgt,
-			      const ComTdbVirtTableKeyInfo * src,
-                              Space * space)
+                              const ComTdbVirtTableKeyInfo * src,
+                              NAMemory * space)
 {
   if (src->colName)
     {
@@ -1685,8 +1685,8 @@ static void initKeyDescStruct(TrafKeysDesc * tgt,
 }
 
 TrafDesc * Generator::createKeyDescs(Int32 numKeys,
-					const ComTdbVirtTableKeyInfo * keyInfo,
-                                        Space * space)
+                                     const ComTdbVirtTableKeyInfo * keyInfo,
+                                     NAMemory * space)
 {
   TrafDesc * first_key_desc = NULL;
 
@@ -1713,8 +1713,8 @@ TrafDesc * Generator::createKeyDescs(Int32 numKeys,
 }
 
 TrafDesc * Generator::createConstrKeyColsDescs(Int32 numKeys,
-                                                  ComTdbVirtTableKeyInfo * keyInfo,
-                                                  Space * space)
+                                               ComTdbVirtTableKeyInfo * keyInfo,
+                                               NAMemory * space)
 {
   TrafDesc * first_key_desc = NULL;
 
@@ -1757,7 +1757,7 @@ TrafDesc * Generator::createConstrKeyColsDescs(Int32 numKeys,
 // see TrafDDLdesc.h for a description of TrafDesc for the priv_desc
 // ****************************************************************************
 TrafDesc * Generator::createPrivDescs( const ComTdbVirtTablePrivInfo * privInfo,
-                                       Space * space)
+                                       NAMemory * space)
 {
   // When authorization is enabled, each object must have at least one grantee
   // - the system grant to the object owner
@@ -1828,7 +1828,7 @@ TrafDesc * Generator::createPrivDescs( const ComTdbVirtTablePrivInfo
* privInfo,
 TrafDesc * Generator::createRefConstrDescStructs(
 						    Int32 numConstrs,
 						    ComTdbVirtTableRefConstraints * refConstrs,
-                                                    Space * space)
+						    NAMemory * space)
 {
   TrafDesc * first_constr_desc = NULL;
 
@@ -1877,7 +1877,7 @@ static Lng32 createDescStructs(char * rforkName,
                                ComTdbVirtTableKeyInfo * keyInfo,
                                TrafDesc* &colDescs,
                                TrafDesc* &keyDescs,
-                               Space * space)
+                               NAMemory * space)
 {
   colDescs = NULL;
   keyDescs = NULL;
@@ -1900,7 +1900,7 @@ static void populateRegionDescForEndKey(char* buf, Int32 len, struct
TrafDesc* t
    target->hbaseRegionDesc()->endKeyLen = len;
 }
 
-static void populateRegionDescAsRANGE(char* buf, Int32 len, struct TrafDesc* target, NAMemory*,
Space*)
+static void populateRegionDescAsRANGE(char* buf, Int32 len, struct TrafDesc* target)
 {
    target->nodetype = DESC_HBASE_RANGE_REGION_TYPE;
    populateRegionDescForEndKey(buf, len, target);
@@ -1911,15 +1911,9 @@ static void populateRegionDescAsRANGE(char* buf, Int32 len, struct
TrafDesc* tar
 // field points at hbaseRegion_desc. The order of the keyinfo, obtained from
 // org.apache.hadoop.hbase.client.HTable.getEndKey(), is preserved.
 //
-// Allocate space from STMTHEAP, per the call of this function
-// in CmpSeabaseDDL::getSeabaseTableDesc() and the
-// Generator::createVirtualTableDesc() call make before this one that
-// uses STMTPHEAP througout.
-//
 TrafDesc* Generator::assembleDescs(
      NAArray<HbaseStr >* keyArray,
-     NAMemory* heap,
-     Space * space)
+     NAMemory * space)
 {
    if (keyArray == NULL)
      return NULL;
@@ -1940,7 +1934,7 @@ TrafDesc* Generator::assembleDescs(
      TrafDesc* wrapper = 
        TrafAllocateDDLdesc(DESC_HBASE_RANGE_REGION_TYPE, space);
      
-     populateRegionDescAsRANGE(buf, len, wrapper, heap, space);
+     populateRegionDescAsRANGE(buf, len, wrapper);
      
      wrapper->next = result;
      result = wrapper;
@@ -1952,6 +1946,7 @@ TrafDesc* Generator::assembleDescs(
 TrafDesc * Generator::createVirtualTableDesc
 (
      const char * inTableName,
+     NAMemory * heap,
      Int32 numCols,
      ComTdbVirtTableColumnInfo * columnInfo,
      Int32 numKeys,
@@ -1976,10 +1971,30 @@ TrafDesc * Generator::createVirtualTableDesc
   // returned contiguous packed copy of it.
   // This packed copy will be stored in metadata.
 
+  // If heap is set (and genPackedDesc is not set), use the heap passed to
+  // us by our caller. For example, we might be called at NATableDB::get time,
+  // to create descriptors that are going to live in the NATable cache or on
+  // the statement heap rather than in a Generator space.
+
+  // There is some danger in this mixed use of the "space" variable as a
+  // base class pointer. The NAMemory and Space classes avoid using virtual
+  // functions, so we can't count on polymorphism to pick the right 
+  // implementation of a method on "space". Rather, the NAMemory methods
+  // will be used unless we explicitly override them. Fortunately, in
+  // almost all of this method, and the methods it calls, the only use of
+  // "space" is as an operand to the GENHEAP macro, which casts it as an
+  // NAMemory * anyway, for use by operator new. That works for both classes.
+  // There is one place in this method where we are concerned with contiguous
+  // placement of objects. There, we have to cast the "space" variable to
+  // class Space to get its methods. (Sorry about the variable naming; it
+  // would have been a lot more changes to rename the "space" variable.)
+
   Space lSpace(ComSpace::GENERATOR_SPACE);
-  Space * space = NULL;
+  NAMemory * space = NULL;
   if (genPackedDesc)
     space = &lSpace;
+  else if (heap)
+    space = heap;
   
   const char * tableName = (tableInfo ? tableInfo->tableName : inTableName);
   TrafDesc * table_desc = TrafAllocateDDLdesc(DESC_TABLE_TYPE, space);
@@ -2310,7 +2325,7 @@ TrafDesc * Generator::createVirtualTableDesc
     {
       // create a list of region descriptors
       table_desc->tableDesc()->hbase_regionkey_desc = 
-        assembleDescs(endKeyArray, STMTHEAP, space);
+        assembleDescs(endKeyArray, space);
     }
 
   if (snapshotName != NULL)
@@ -2322,12 +2337,20 @@ TrafDesc * Generator::createVirtualTableDesc
 
   if (genPackedDesc && space)
     {
-      // pack generated desc and move it to a contiguous buffer before return.
-      DescStructPtr((TrafDesc*)table_desc).pack(space);
+      if (! space->isComSpace() ) // to insure cast (Space *) is safe
+        {
+          table_desc = NULL;
+          return table_desc;
+        }  
+
+      Space * trueSpace = (Space *)space; // space really is a Space
 
-      Lng32 allocSize = space->getAllocatedSpaceSize();
+      // pack generated desc and move it to a contiguous buffer before return.
+      DescStructPtr((TrafDesc*)table_desc).pack(trueSpace);
+      Lng32 allocSize = trueSpace->getAllocatedSpaceSize();
       char * contigTableDesc = new HEAP char[allocSize];
-      if (! space->makeContiguous(contigTableDesc, allocSize))
+ 
+      if (! trueSpace->makeContiguous(contigTableDesc, allocSize))
         {
           table_desc = NULL;
           return table_desc;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/generator/Generator.h
----------------------------------------------------------------------
diff --git a/core/sql/generator/Generator.h b/core/sql/generator/Generator.h
index d1f2534..6764ac5 100644
--- a/core/sql/generator/Generator.h
+++ b/core/sql/generator/Generator.h
@@ -1398,26 +1398,27 @@ public:
        ComTdbVirtTableColumnInfo * columnInfo,
        Int16 numCols,
        UInt32 &offset,
-       Space * space);
+       NAMemory * space);
   
   static TrafDesc * createKeyDescs(Int32 numKeys,
-				      const ComTdbVirtTableKeyInfo * keyInfo,
-                                      Space * space);
+                                   const ComTdbVirtTableKeyInfo * keyInfo,
+                                   NAMemory * space);
 
   static TrafDesc * createConstrKeyColsDescs(Int32 numKeys,
-                                                ComTdbVirtTableKeyInfo * keyInfo,
-                                                Space * space);
+                                             ComTdbVirtTableKeyInfo * keyInfo,
+                                             NAMemory * space);
 
   static TrafDesc * createRefConstrDescStructs(
 						  Int32 numConstrs,
 						  ComTdbVirtTableRefConstraints * refConstrs,
-                                                  Space * space);
+						  NAMemory * space);
   
   static TrafDesc * createPrivDescs( const ComTdbVirtTablePrivInfo * privs,
-                                     Space * space);
+                                     NAMemory * space);
 
   static TrafDesc *createVirtualTableDesc(
-       const char * tableName, 
+       const char * tableName,
+       NAMemory * heap,  // in case caller wants a particular heap; if NULL is passed, we
decide
        Int32 numCols,
        ComTdbVirtTableColumnInfo * columnInfo,
        Int32 numKeys,
@@ -1439,8 +1440,7 @@ public:
 
   static TrafDesc* assembleDescs(
      NAArray<HbaseStr >* keyArray, 
-     NAMemory* heap,
-     Space * space);
+     NAMemory* space);
 
   static TrafDesc *createVirtualRoutineDesc(
                                   const char *routineName,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/optimizer/NATable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NATable.cpp b/core/sql/optimizer/NATable.cpp
index 0a4dd6f..ec5cc44 100644
--- a/core/sql/optimizer/NATable.cpp
+++ b/core/sql/optimizer/NATable.cpp
@@ -8255,10 +8255,12 @@ NATable * NATableDB::get(CorrName& corrName, BindWA * bindWA,
 
           NAArray<HbaseStr> *keyArray = NATable::getRegionsBeginKey(extHBaseName);
 
+          // create the virtual table descriptor on the same heap that
+          // we are creating the NATable object on
 	  tableDesc = 
 	    HbaseAccess::createVirtualTableDesc
 	    (corrName.getExposedNameAsAnsiString(FALSE, TRUE).data(),
-	     isHbaseRow, isHbaseCell, keyArray);
+	     isHbaseRow, isHbaseCell, keyArray, naTableHeap);
           deleteNAArray(STMTHEAP, keyArray);
 
 	  isSeabase = FALSE;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/optimizer/RelScan.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelScan.h b/core/sql/optimizer/RelScan.h
index 1584216..14068e0 100644
--- a/core/sql/optimizer/RelScan.h
+++ b/core/sql/optimizer/RelScan.h
@@ -1302,7 +1302,8 @@ public:
   static TrafDesc *createVirtualTableDesc(const char * name,
 					     NABoolean isRW = FALSE,
 					     NABoolean isCW = FALSE, 
-                                             NAArray<HbaseStr> * hbaseKeys = NULL);
+					     NAArray<HbaseStr> * hbaseKeys = NULL,
+					     NAMemory * heap = NULL);
 
   static TrafDesc *createVirtualTableDesc(const char * name,
 					     NAList<char*> &colNameList,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/optimizer/ValueDesc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ValueDesc.cpp b/core/sql/optimizer/ValueDesc.cpp
index 754ecdd..2aa288b 100644
--- a/core/sql/optimizer/ValueDesc.cpp
+++ b/core/sql/optimizer/ValueDesc.cpp
@@ -6794,7 +6794,8 @@ ValueIdList::computeEncodedKey(const TableDesc* tDesc, NABoolean isMaxKey,
    // cast away const since the method may compute and store the length
    keyBufLen = ((NAFileSet*)naf)->getEncodedKeyLength(); 
 
-   if ( naTable->isHbaseCellTable() || naTable->isHbaseRowTable() ) { 
+   if ( (count > 0) && (inputStrings[0]) && 
+        ( naTable->isHbaseCellTable() || naTable->isHbaseRowTable() ) ) { 
       // the encoded key for Native Hbase table is a null-terminated string ('<key>')
       NAString key;
       key.append("(");
@@ -6815,6 +6816,8 @@ ValueIdList::computeEncodedKey(const TableDesc* tDesc, NABoolean isMaxKey,
       memcpy(encodedKeyBuffer, key.data(), key.length());
       encodedKeyBuffer[key.length()] = NULL;
 
+      NADELETEARRAY(inputStrings, count, NAStringPtr, STMTHEAP);
+
       return encodedKeyBuffer;
 
    } else {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/sqlcat/TrafDDLdesc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcat/TrafDDLdesc.cpp b/core/sql/sqlcat/TrafDDLdesc.cpp
index a3ad81f..e13b239 100644
--- a/core/sql/sqlcat/TrafDDLdesc.cpp
+++ b/core/sql/sqlcat/TrafDDLdesc.cpp
@@ -29,7 +29,7 @@
 // Allocate one of the primitive structs and initialize to all zeroes.
 // Uses HEAP (StatementHeap) of CmpCommon or space.
 // -----------------------------------------------------------------------
-TrafDesc *TrafAllocateDDLdesc(desc_nodetype nodetype, Space * space)
+TrafDesc *TrafAllocateDDLdesc(desc_nodetype nodetype, NAMemory * space)
 {
   size_t size = 0;
   TrafDesc * desc_ptr = NULL;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/sqlcat/TrafDDLdesc.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcat/TrafDDLdesc.h b/core/sql/sqlcat/TrafDDLdesc.h
index 601ad96..0292bec 100644
--- a/core/sql/sqlcat/TrafDDLdesc.h
+++ b/core/sql/sqlcat/TrafDDLdesc.h
@@ -104,7 +104,7 @@ public:
   enum {CURR_VERSION = 1};
 
   TrafDesc(UInt16 nodeType);
-  TrafDesc() : NAVersionedObject(-1) {}
+  TrafDesc() : NAVersionedObject(-1),descExtension(NULL) {}
 
   // ---------------------------------------------------------------------
   // Redefine virtual functions required for Versioning.
@@ -163,7 +163,7 @@ public:
 
 class TrafCheckConstrntsDesc : public TrafDesc {
 public:
-  TrafCheckConstrntsDesc() : TrafDesc(DESC_CHECK_CONSTRNTS_TYPE)
+  TrafCheckConstrntsDesc() : TrafDesc(DESC_CHECK_CONSTRNTS_TYPE), constrnt_text(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -192,7 +192,9 @@ public:
 
 class TrafColumnsDesc : public TrafDesc {
 public:
-  TrafColumnsDesc() : TrafDesc(DESC_COLUMNS_TYPE) 
+  TrafColumnsDesc() : TrafDesc(DESC_COLUMNS_TYPE), colname(NULL),
+    pictureText(NULL), defaultvalue(NULL), heading(NULL),
+    computed_column_text(NULL), hbaseColFam(NULL), hbaseColQual(NULL)
   {};
 
   // ---------------------------------------------------------------------
@@ -305,7 +307,7 @@ public:
 
 class TrafConstrntKeyColsDesc : public TrafDesc {
 public:
-  TrafConstrntKeyColsDesc() : TrafDesc(DESC_CONSTRNT_KEY_COLS_TYPE)
+  TrafConstrntKeyColsDesc() : TrafDesc(DESC_CONSTRNT_KEY_COLS_TYPE), colname(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -338,7 +340,8 @@ public:
 
 class TrafConstrntsDesc : public TrafDesc {
 public:
-  TrafConstrntsDesc() : TrafDesc(DESC_CONSTRNTS_TYPE)
+  TrafConstrntsDesc() : TrafDesc(DESC_CONSTRNTS_TYPE),
+    constrntname(NULL), tablename(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -432,7 +435,8 @@ public:
 
 class TrafHbaseRegionDesc : public TrafDesc {
 public:
-  TrafHbaseRegionDesc() : TrafDesc(DESC_HBASE_RANGE_REGION_TYPE)
+  TrafHbaseRegionDesc() : TrafDesc(DESC_HBASE_RANGE_REGION_TYPE),
+    beginKey(NULL), endKey(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -468,7 +472,8 @@ public:
 
 class TrafHistogramDesc : public TrafDesc {
 public:
-  TrafHistogramDesc() : TrafDesc(DESC_HISTOGRAM_TYPE)
+  TrafHistogramDesc() : TrafDesc(DESC_HISTOGRAM_TYPE),
+    tablename(NULL), histid(NULL), highval(NULL), lowval(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -512,7 +517,8 @@ public:
 
 class TrafHistIntervalDesc : public TrafDesc {
 public:
-  TrafHistIntervalDesc() : TrafDesc(DESC_HIST_INTERVAL_TYPE)
+  TrafHistIntervalDesc() : TrafDesc(DESC_HIST_INTERVAL_TYPE),
+    histid(NULL), intboundary(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -551,7 +557,9 @@ public:
 
 class TrafIndexesDesc : public TrafDesc {
 public:
-  TrafIndexesDesc() : TrafDesc(DESC_INDEXES_TYPE)
+  TrafIndexesDesc() : TrafDesc(DESC_INDEXES_TYPE), 
+    partitioningScheme_(COM_UNSPECIFIED_PARTITIONING),
+    tablename(NULL), indexname(NULL), hbaseSplitClause(NULL), hbaseCreateOptions(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -646,7 +654,8 @@ public:
 
 class TrafKeysDesc : public TrafDesc {
 public:
-  TrafKeysDesc() : TrafDesc(DESC_KEYS_TYPE)
+  TrafKeysDesc() : TrafDesc(DESC_KEYS_TYPE), keyname(NULL),
+    hbaseColFam(NULL), hbaseColQual(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -692,7 +701,8 @@ public:
 
 class TrafLibraryDesc : public TrafDesc {
 public:
-  TrafLibraryDesc() : TrafDesc(DESC_LIBRARY_TYPE)
+  TrafLibraryDesc() : TrafDesc(DESC_LIBRARY_TYPE),
+    libraryName(NULL), libraryFilename(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -727,7 +737,15 @@ public:
 
 class TrafPartnsDesc : public TrafDesc {
 public:
-  TrafPartnsDesc() : TrafDesc(DESC_PARTNS_TYPE)
+  TrafPartnsDesc() : TrafDesc(DESC_PARTNS_TYPE),
+    tablename(NULL), 
+    partitionname(NULL),
+    logicalpartitionname(NULL),
+    firstkey(NULL),
+    encodedkey(NULL),
+    lowKey(NULL),
+    highKey(NULL),
+    givenname(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -769,7 +787,8 @@ public:
 
 class TrafRefConstrntsDesc : public TrafDesc {
 public:
-  TrafRefConstrntsDesc() : TrafDesc(DESC_REF_CONSTRNTS_TYPE)
+  TrafRefConstrntsDesc() : TrafDesc(DESC_REF_CONSTRNTS_TYPE),
+    constrntname(NULL), tablename(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -801,7 +820,9 @@ public:
 
 class TrafRoutineDesc : public TrafDesc {
 public:
-  TrafRoutineDesc() : TrafDesc(DESC_ROUTINE_TYPE)
+  TrafRoutineDesc() : TrafDesc(DESC_ROUTINE_TYPE),
+    routineName(NULL), externalName(NULL), librarySqlName(NULL), libraryFileName(NULL),
+    signature(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -856,7 +877,8 @@ public:
 
 class TrafSequenceGeneratorDesc : public TrafDesc {
 public:
-  TrafSequenceGeneratorDesc() : TrafDesc(DESC_SEQUENCE_GENERATOR_TYPE)
+  TrafSequenceGeneratorDesc() : TrafDesc(DESC_SEQUENCE_GENERATOR_TYPE),
+    sgLocation(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -907,7 +929,8 @@ public:
 
 class TrafTableDesc : public TrafDesc {
 public:
-  TrafTableDesc() : TrafDesc(DESC_TABLE_TYPE)
+  TrafTableDesc() : TrafDesc(DESC_TABLE_TYPE), tablename(NULL),
+    snapshotName(NULL), default_col_fam(NULL), all_col_fams(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -1051,7 +1074,7 @@ public:
 
 class TrafUsingMvDesc : public TrafDesc {
 public:
-  TrafUsingMvDesc() : TrafDesc(DESC_USING_MV_TYPE)
+  TrafUsingMvDesc() : TrafDesc(DESC_USING_MV_TYPE), mvName(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -1088,7 +1111,9 @@ public:
 
 class TrafViewDesc : public TrafDesc {
 public:
-  TrafViewDesc() : TrafDesc(DESC_VIEW_TYPE)
+  TrafViewDesc() : TrafDesc(DESC_VIEW_TYPE),
+    viewname(NULL), viewfilename(NULL), viewtext(NULL),
+    viewchecktext(NULL), viewcolusages(NULL)
   {}
 
   // ---------------------------------------------------------------------
@@ -1246,9 +1271,9 @@ public:
 };
 // ------------------------- end privilege descriptors -------------------------
 
-// if space is passed in, use it. Otherwise use HEAP of CmpCommon
+// if heap is passed in, use it. Otherwise use HEAP of CmpCommon
 TrafDesc *TrafAllocateDDLdesc(desc_nodetype nodetype, 
-                                 Space *space);
+                              NAMemory * heap);
 
 TrafDesc *TrafMakeColumnDesc
 (
@@ -1260,7 +1285,7 @@ TrafDesc *TrafMakeColumnDesc
      Lng32 &offset,		  // INOUT
      NABoolean null_flag,
      SQLCHARSET_CODE datacharset, // i.e., use CharInfo::DefaultCharSet;
-     Space * space
+     NAMemory * space
  );
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/sqlcat/readRealArk.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcat/readRealArk.cpp b/core/sql/sqlcat/readRealArk.cpp
index e49553c..62e7232 100644
--- a/core/sql/sqlcat/readRealArk.cpp
+++ b/core/sql/sqlcat/readRealArk.cpp
@@ -71,7 +71,7 @@ TrafDesc *TrafMakeColumnDesc(const char *tablename,
                                 Lng32 &offset,	// INOUT
                                 NABoolean null_flag,
                                 SQLCHARSET_CODE datacharset,
-                                Space * space
+                                NAMemory * space
                                 )
 {
   #undef  COLUMN

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/8d9c1d17/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 7e50c99..17532c3 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -11087,6 +11087,7 @@ TrafDesc * CmpSeabaseDDL::getSeabaseMDTableDesc(
   tableDesc =
     Generator::createVirtualTableDesc
     ((char*)extTableName.data(),
+     NULL, // let it decide what heap to use
      colInfoSize,
      (ComTdbVirtTableColumnInfo*)colInfo,
      keyInfoSize,
@@ -11183,6 +11184,7 @@ TrafDesc * CmpSeabaseDDL::getSeabaseHistTableDesc(const NAString &catName,
   tableDesc =
     Generator::createVirtualTableDesc
     ((char*)extTableName.data(),
+     NULL, // let it decide what heap to use
      numCols,
      colInfo,
      numKeys,
@@ -11662,6 +11664,7 @@ TrafDesc * CmpSeabaseDDL::getSeabaseSequenceDesc(const NAString &catName,
   tableDesc =
     Generator::createVirtualTableDesc
     ((char*)extSeqName.data(),
+     NULL, // let it decide what heap to use
      0, NULL, // colInfo
      0, NULL, // keyInfo
      0, NULL,
@@ -12522,6 +12525,7 @@ TrafDesc * CmpSeabaseDDL::getSeabaseUserTableDesc(const NAString &catName,
     Generator::createVirtualTableDesc
     (
      extTableName->data(), //objName,
+     NULL, // let it decide what heap to use
      numCols,
      colInfoArray,
      tableKeyInfo->numEntries(), //keyIndex,


Mime
View raw message