support for get command for LOB tables. Support for tracing LOB operations.


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

Branch: refs/heads/master
Commit: bbe87c923d6fcfedf5ddbccc2d05f5aa07dc87df
Parents: 616961d
Author: Sandhya Sundaresan <[email protected]>
Authored: Fri Apr 15 07:32:38 2016 +0000
Committer: Sandhya Sundaresan <[email protected]>
Committed: Fri Apr 15 07:32:38 2016 +0000

----------------------------------------------------------------------
 .../sqf/conf/log4cxx.trafodion.masterexe.config |   1 +
 core/sql/cli/Cli.cpp                            | 130 ++--
 core/sql/cli/Cli.h                              |   9 +-
 core/sql/cli/CliExtern.cpp                      |  16 +-
 core/sql/cli/SessionDefaults.cpp                |   1 +
 core/sql/cli/Statement.cpp                      |   2 +-
 core/sql/comexe/ComTdb.cpp                      |   8 +-
 core/sql/comexe/ComTdb.h                        |   1 +
 core/sql/comexe/ComTdbExeUtil.cpp               |  74 +++
 core/sql/comexe/ComTdbExeUtil.h                 | 122 ++++
 core/sql/executor/ExComTdb.cpp                  |   8 +
 core/sql/executor/ExExeUtil.h                   | 176 ++++++
 core/sql/executor/ExExeUtilGet.cpp              | 586 ++++++++++++++++++-
 core/sql/executor/ExExeUtilLoad.cpp             |   4 +-
 core/sql/exp/ExpLOBaccess.cpp                   | 441 ++++++++++----
 core/sql/exp/ExpLOBaccess.h                     |  10 +-
 core/sql/exp/ExpLOBexternal.h                   |   9 +-
 core/sql/exp/ExpLOBprocess.cpp                  |   4 +-
 core/sql/export/ComDiags.cpp                    |   8 +-
 core/sql/generator/GenRelExeUtil.cpp            | 161 ++++-
 core/sql/optimizer/NATable.cpp                  |   2 +-
 core/sql/optimizer/RelExeUtil.cpp               | 119 ++++
 core/sql/optimizer/RelExeUtil.h                 |  42 ++
 core/sql/parser/sqlparser.y                     |  23 +-
 core/sql/regress/executor/EXPECTED130           | 113 +++-
 core/sql/regress/executor/FILTER130             |   1 +
 core/sql/regress/executor/TEST130               |  19 +
 core/sql/sqlcomp/CmpSeabaseDDLcleanup.cpp       |   6 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |  12 +-
 core/sql/sqlmxevents/logmxevent_traf.cpp        |   8 +-
 core/sql/sqlmxevents/logmxevent_traf.h          |   2 +-
 31 files changed, 1919 insertions(+), 199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sqf/conf/log4cxx.trafodion.masterexe.config
----------------------------------------------------------------------
diff --git a/core/sqf/conf/log4cxx.trafodion.masterexe.config 
b/core/sqf/conf/log4cxx.trafodion.masterexe.config
index 5d037ce..a5c6194 100644
--- a/core/sqf/conf/log4cxx.trafodion.masterexe.config
+++ b/core/sqf/conf/log4cxx.trafodion.masterexe.config
@@ -47,6 +47,7 @@ log4j.appender.mxoAppender.layout.ConversionPattern=%d, %p, 
%c, %m%n
 log4j.logger.MXOSRVR=ERROR, mxoAppender
 
 # SQL
+# uncomment the following line if you want to enable debug logging
 #log4j.logger.SQL.EXE=DEBUG
 log4j.logger.SQL=INFO
 log4j.logger.SQL.COMP=ERROR

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/cli/Cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.cpp b/core/sql/cli/Cli.cpp
index a6b7f1a..09f03c5 100644
--- a/core/sql/cli/Cli.cpp
+++ b/core/sql/cli/Cli.cpp
@@ -9409,7 +9409,8 @@ Lng32 SQLCLI_LOBcliInterface
                                                                              
  /*INOUT*/    Int64 * inoutDescSyskey,    /* returned after insert and select  
                                                                               
  /*INOUT*/  void* *inCliInterface,
- /*IN*/     Int64 xnId          /* xn id of the parent process, if non-zero */
+ /*IN*/     Int64 xnId,          /* xn id of the parent process, if non-zero */
+ /*IN*/     NABoolean lobTrace
  )
 {
   ContextCli   & currContext = *(cliGlobals->currContext());
@@ -9438,31 +9439,40 @@ Lng32 SQLCLI_LOBcliInterface
   Int64 inDescSyskey, descPartnKey;
   short schNameLen = 0;
   char schName[512];
+  char logBuf[4096];
+  lobDebugInfo("In LobCliInterface",0,__LINE__,lobTrace);
   if (inLobHandle)
     {
       ExpLOBoper::extractFromLOBhandle(&flags, &lobType, &lobNum, &uid,  
                                       &inDescSyskey, &descPartnKey,
                                       &schNameLen, schName,
                                       inLobHandle);
+      str_sprintf(logBuf,"Handle contents : flags %d, lobType %d, lobNum :%d, 
uid : %Ld, descSyskey: %Ld, descPartnKey : %Ld, schNameLen:%d, schName %s", 
flags,lobType,lobNum,uid,inDescSyskey,descPartnKey,schNameLen,schName);
+       lobDebugInfo(logBuf,0,__LINE__,lobTrace);
     }
 
+  
   char tgtLobNameBuf[100];
   char * tgtLobName = 
     ExpLOBoper::ExpGetLOBname(uid, lobNum, tgtLobNameBuf, 100);
-
+  str_sprintf(logBuf,"lobName %s", tgtLobName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   char lobDescHandleNameBuf[1024];
   Lng32 lobDescHandleNameLen = 1024;
   char * lobDescHandleName = 
     ExpLOBoper::ExpGetLOBDescHandleName(schNameLen, schName, uid, lobNum,
                                        lobDescHandleNameBuf, 
lobDescHandleNameLen);
-  
+  str_sprintf(logBuf,"lobDescHandleName %s", lobDescHandleName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   char lobDescChunksNameBuf[1024];
   Lng32 lobDescChunksNameLen = 1024;
   char * lobDescChunksName = 
     ExpLOBoper::ExpGetLOBDescChunksName(schNameLen, schName, uid, lobNum,
                                        lobDescChunksNameBuf, 
lobDescChunksNameLen);
   
- 
+  str_sprintf(logBuf,"lobDescChunksName %s", lobDescChunksName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
+
   char * query = new(currContext.exHeap()) char[4096];
 
   if (outLobHandleLen)
@@ -9523,7 +9533,7 @@ Lng32 SQLCLI_LOBcliInterface
        str_sprintf(query, "create ghost table %s (descPartnKey largeint not 
null, numChunks int not null, lobLen largeint not null) salt using 8 partitions 
store by (descPartnKey, syskey) ",
                    lobDescHandleName);
        
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        currContext.setSqlParserFlags(0x1);
        
        cliRC = cliInterface->executeImmediate(query);
@@ -9541,7 +9551,7 @@ Lng32 SQLCLI_LOBcliInterface
                // create lob descriptor chunks table salted
                str_sprintf(query, "create ghost table %s (descPartnKey 
largeint not null, descSysKey largeint not null, chunkNum int not null, 
chunkLen largeint not null, dataOffset largeint, stringParam varchar(400), 
primary key(descPartnKey, descSysKey, chunkNum)) salt using 8 partitions",
        lobDescChunksName); 
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
 
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
@@ -9566,7 +9576,7 @@ Lng32 SQLCLI_LOBcliInterface
       {
        str_sprintf(query, "drop ghost table %s",
                    lobDescHandleName);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9583,7 +9593,7 @@ Lng32 SQLCLI_LOBcliInterface
 
        str_sprintf(query, "drop ghost table %s",
                    lobDescChunksName);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9609,7 +9619,7 @@ Lng32 SQLCLI_LOBcliInterface
       {
        str_sprintf(query, "cleanup table %s",
                    lobDescHandleName);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9625,7 +9635,7 @@ Lng32 SQLCLI_LOBcliInterface
 
        str_sprintf(query, "cleanup table %s",
                    lobDescChunksName);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9647,7 +9657,7 @@ Lng32 SQLCLI_LOBcliInterface
        // insert into lob descriptor handle table
        str_sprintf(query, "select syskey from (insert into table(ghost table 
%s) values (%Ld, 1, %Ld)) x",
                    lobDescHandleName, descPartnKey, (dataLen ? *dataLen : 0));
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9672,6 +9682,7 @@ Lng32 SQLCLI_LOBcliInterface
                        (dataLen ? *dataLen : 0),
                        (dataOffset ? *dataOffset : 0),
                        blackBox);
+            lobDebugInfo(query,0,__LINE__,lobTrace);
          }
        else
          {
@@ -9679,6 +9690,7 @@ Lng32 SQLCLI_LOBcliInterface
                        lobDescChunksName, descPartnKey, descSyskey,
                        (dataLen ? *dataLen : 0),
                        (dataOffset ? *dataOffset : 0));
+            lobDebugInfo(query,0,__LINE__,lobTrace);
          }
 
        // set parserflags to allow ghost table
@@ -9723,7 +9735,7 @@ Lng32 SQLCLI_LOBcliInterface
                    lobDescHandleName, 
                    (dataLen ? *dataLen : 0),
                    descPartnKey, inDescSyskey);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9765,6 +9777,7 @@ Lng32 SQLCLI_LOBcliInterface
                        numChunks, (dataLen ? *dataLen : 0),
                        (dataOffset ? *dataOffset : 0),
                        blackBox);
+            lobDebugInfo(query,0,__LINE__,lobTrace);
          }
        else
          {
@@ -9773,6 +9786,7 @@ Lng32 SQLCLI_LOBcliInterface
                        numChunks, (dataLen ? *dataLen : 0),
                        (dataOffset ? *dataOffset : 0)
                        );
+            lobDebugInfo(query,0,__LINE__,lobTrace);
          }
        
        // set parserflags to allow ghost table
@@ -9811,7 +9825,7 @@ Lng32 SQLCLI_LOBcliInterface
                    lobDescHandleName, 
                    (dataLen ? *dataLen : 0),
                    descPartnKey, inDescSyskey);
-       
+       lobDebugInfo(query,0,__LINE__,lobTrace);
 
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
@@ -9854,14 +9868,15 @@ Lng32 SQLCLI_LOBcliInterface
                        (dataLen ? *dataLen : 0),
                        (dataOffset ? *dataOffset : 0),
                        blackBox);
-           
+           lobDebugInfo(query,0,__LINE__,lobTrace);
          }
        else
          {
           str_sprintf(query, "insert into table(ghost table %s) values (%Ld, 
%Ld, 1, %Ld, %Ld, NULL)",
                        lobDescChunksName, descPartnKey, inDescSyskey,
                        (dataLen ? *dataLen : 0),
-                       (dataOffset ? *dataOffset : 0)); 
+                       (dataOffset ? *dataOffset : 0));
+           lobDebugInfo(query,0,__LINE__,lobTrace);
          }
          
        // set parserflags to allow ghost table
@@ -9901,7 +9916,7 @@ Lng32 SQLCLI_LOBcliInterface
        // delete from lob descriptor handle table
        str_sprintf(query, "delete from table(ghost table %s) where 
descPartnKey = %Ld and syskey = %Ld",
                    lobDescHandleName, descPartnKey, inDescSyskey);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9919,7 +9934,7 @@ Lng32 SQLCLI_LOBcliInterface
        // delete from lob descriptor chunks table
        str_sprintf(query, "delete from table(ghost table %s) where 
descPartnKey = %Ld and descSysKey = %Ld",
                    lobDescChunksName, descPartnKey, inDescSyskey);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9944,7 +9959,7 @@ Lng32 SQLCLI_LOBcliInterface
        str_sprintf(query, "select numChunks from table(ghost table %s) where 
descPartnKey = %Ld for read committed access",
                    lobDescHandleName,
                    descPartnKey);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -9996,7 +10011,7 @@ Lng32 SQLCLI_LOBcliInterface
        str_sprintf(query, "select c.chunkLen, c.dataOffset from table(ghost 
table %s) h, table(ghost table %s) c where h.descPartnKey = c.descPartnKey and 
h.syskey = c.descSyskey and h.descPartnKey = %Ld and h.syskey = %Ld and 
c.chunkNum = h.numChunks for read committed access",
                    lobDescHandleName, lobDescChunksName, 
                    descPartnKey, inDescSyskey);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10063,7 +10078,7 @@ Lng32 SQLCLI_LOBcliInterface
       {
        str_sprintf(query, "select dataOffset, chunkLen from table(ghost table 
%s) where descPartnKey = %Ld and descSyskey = %Ld order by chunkNum for read 
committed access",
                    lobDescChunksName, descPartnKey, inDescSyskey);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10148,7 +10163,7 @@ Lng32 SQLCLI_LOBcliInterface
        // delete data from the handle desc table
        str_sprintf(query, "delete from table(ghost table %s)",
                    lobDescHandleName);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10166,7 +10181,7 @@ Lng32 SQLCLI_LOBcliInterface
        // delete data from the chunks desc table
        str_sprintf(query, "delete from table(ghost table %s)",
                    lobDescChunksName);
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10189,7 +10204,7 @@ Lng32 SQLCLI_LOBcliInterface
        //aggregate on chunklen for this lob.
 
        str_sprintf (query,  "select sum(chunklen) from  %s   where 
descpartnkey = %Ld and descsyskey = %Ld ", lobDescChunksName, descPartnKey, 
inDescSyskey );
-
+        lobDebugInfo(query,0,__LINE__,lobTrace);
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10283,11 +10298,13 @@ Lng32 SQLCLI_LOB_GC_Interface
      /*IN*/     char*  hdfsServer,
      /*IN*/     Lng32  hdfsPort,
      /*IN*/     char  *lobLocation,
-     /*IN*/    Int64 lobMaxMemChunkLen // if passed in as 0, will use default 
value of 1G for the in memory buffer to do compaction.
+     /*IN*/    Int64 lobMaxMemChunkLen, // if passed in as 0, will use default 
value of 1G for the in memory buffer to do compaction.
+     /*IN*/    NABoolean lobTrace
  )
 {
   Lng32 cliRC = 0;
-
+  char logBuf[4096];
+  lobDebugInfo("In LOB_GC_Interface",0,__LINE__,lobTrace);
   ContextCli   & currContext = *(cliGlobals->currContext());
   ComDiagsArea & diags       = currContext.diags();
 
@@ -10314,22 +10331,27 @@ Lng32 SQLCLI_LOB_GC_Interface
                                       &schNameLen, schName,
                                       handle);
     }
-
+  str_sprintf(logBuf,"flags %d, lobType %d, lobNum :%d, uid : %Ld, descSyskey: 
%Ld, descPartnKey : %Ld, schNameLen:%d, schName %s", 
flags,lobType,lobNum,uid,inDescSyskey,inDescPartnKey,schNameLen,schName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   char tgtLobNameBuf[100];
   char * tgtLobName = 
     ExpLOBoper::ExpGetLOBname(uid, lobNum, tgtLobNameBuf, 100);
-
+  str_sprintf(logBuf,"lobName %s", tgtLobName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   char lobDescHandleNameBuf[1024];
   Lng32 lobDescHandleNameLen = 1024;
   char * lobDescHandleName = 
     ExpLOBoper::ExpGetLOBDescHandleName(schNameLen, schName, uid, lobNum,
                                        lobDescHandleNameBuf, 
lobDescHandleNameLen);
-  
+  str_sprintf(logBuf,"lobDescHandleName %s", lobDescHandleName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   char lobDescChunksNameBuf[1024];
   Lng32 lobDescChunksNameLen = 1024;
   char * lobDescChunksName = 
     ExpLOBoper::ExpGetLOBDescChunksName(schNameLen, schName, uid, lobNum,
                                        lobDescChunksNameBuf, 
lobDescChunksNameLen);
+  str_sprintf(logBuf,"lobDescChunksName %s", lobDescChunksName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   
  
   char * query = new(currContext.exHeap()) char[4096];
@@ -10337,14 +10359,15 @@ Lng32 SQLCLI_LOB_GC_Interface
   //in memory array.
   str_sprintf(query, "select count(*) from table(ghost table %s) ",
               lobDescChunksName);                  
-
+  lobDebugInfo(query,0,__LINE__,lobTrace);
   // set parserflags to allow ghost table
   currContext.setSqlParserFlags(0x1);
        
   Lng32 numEntries = 0;
   Lng32 len;
   cliRC = cliInterface->executeImmediate(query, (char*)&numEntries, &len, 
FALSE);
-
+  str_sprintf(logBuf,"Number of entries in descchunktable %s is 
%d",lobDescChunksName, numEntries);
+   lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   currContext.resetSqlParserFlags(0x1);
 
   if (cliRC < 0)
@@ -10360,7 +10383,7 @@ Lng32 SQLCLI_LOB_GC_Interface
         
   str_sprintf(query, "select dataOffset, 
descPartnKey,descSyskey,chunkLen,chunkNum from table(ghost table %s) order by 
dataOffset for read committed access",
               lobDescChunksName);
-
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   // set parserflags to allow ghost table
   currContext.setSqlParserFlags(0x1);
        
@@ -10416,6 +10439,10 @@ Lng32 SQLCLI_LOB_GC_Interface
       dcInMemoryArray[i].setSyskey(descSyskey);
       dcInMemoryArray[i].setChunkLen(chunkLen);
       dcInMemoryArray[i].setChunkNum(chunkNum);
+
+      str_sprintf(logBuf,"Fetched for entry i=%d; currentOffset:%Ld, 
descPartnKey:%Ld, sysKey:%Ld, chunkLen:%Ld,chunkNum %d", 
i,currentOffset,descPartnKey,descSyskey,chunkLen,chunkNum);
+      lobDebugInfo(logBuf,0,__LINE__,lobTrace);
+
       cliRC = cliInterface->fetch();
       i++;
       if (cliRC < 0)
@@ -10438,7 +10465,8 @@ Lng32 SQLCLI_LOB_GC_Interface
  
   // adjust in memory array to calculate holes and new offsets.
   ExpLOBoper::calculateNewOffsets(dcInMemoryArray,numEntries);
-        
+  lobDebugInfo("Calculated new offsets",0,__LINE__,lobTrace);
+    
         
   // Update the descChunks table with new offsets
   //TBD start a separate transaction to manage this.
@@ -10452,6 +10480,7 @@ Lng32 SQLCLI_LOB_GC_Interface
         i++;
       else
         {
+         
           str_sprintf(query, "update table(ghost table %s) set dataOffset=%Ld, 
chunkLen = %Ld where descPartnKey = %Ld and descSysKey = %Ld",
                       lobDescChunksName, 
                       dcInMemoryArray[i].getNewOffset(),
@@ -10459,6 +10488,8 @@ Lng32 SQLCLI_LOB_GC_Interface
                       dcInMemoryArray[i].getDescPartnKey(), 
                       dcInMemoryArray[i].getSyskey());
           // set parserflags to allow ghost table
+          lobDebugInfo(query,0,__LINE__,lobTrace);
+
           currContext.setSqlParserFlags(0x1);
        
           cliRC = cliInterface->executeImmediate(query);
@@ -10484,6 +10515,8 @@ Lng32 SQLCLI_LOB_GC_Interface
     {
       cliRC = 9999; // Warning 
       ComDiagsArea * da = &diags;
+      lobDebugInfo("compactLobDataFile Failed",0,__LINE__,lobTrace);
+
       ExRaiseSqlError(currContext.exHeap(), &da, 
                       (ExeErrorCode)(8442), NULL, &cliRC    , 
                       &rc, NULL, (char*)"Lob GC call",
@@ -10495,6 +10528,10 @@ Lng32 SQLCLI_LOB_GC_Interface
 
       // Restore original data file.
       Int32 rc2=ExpLOBoper::restoreLobDataFile(lobGlobals,tgtLobName, (void 
*)currContext.exHeap(),hdfsServer,hdfsPort,lobLocation);
+      if (rc2)
+        {
+          lobDebugInfo("restoreLobDataFile Failed",0,__LINE__,lobTrace);
+        }
       // if error restoring, this lob could become corrupt.
       goto error_return;
     }
@@ -10502,6 +10539,7 @@ Lng32 SQLCLI_LOB_GC_Interface
     {
       //TBD :commit all updates and remove the saved copy of datafile
       ExpLOBoper::purgeBackupLobDataFile(lobGlobals, tgtLobName,(void 
*)currContext.exHeap(),hdfsServer,hdfsPort,lobLocation);
+      lobDebugInfo("purgedLobDataFile ",0,__LINE__,lobTrace);
     }
   }
  error_return:
@@ -10536,7 +10574,8 @@ Lng32 SQLCLI_LOBddlInterface
  /*IN*/     char* *lobLocList,
  /*IN*/     char *hdfsServer,
  /*IN*/     Int32 hdfsPort,
- /*IN*/    Int64 lobMaxSize
+/*IN*/    Int64 lobMaxSize,
+/*IN*/    NABoolean lobTrace
  )
  
 {
@@ -10546,7 +10585,8 @@ Lng32 SQLCLI_LOBddlInterface
   ComDiagsArea & diags       = currContext.diags();
 
   ComDiagsArea * myDiags = ComDiagsArea::allocate(currContext.exHeap());
-
+  char logBuf[4096];
+  lobDebugInfo("In LOBddlInterface",0,__LINE__,lobTrace);
   ExeCliInterface *cliInterface = NULL;
   cliInterface = new (currContext.exHeap()) 
     ExeCliInterface(currContext.exHeap(),
@@ -10559,17 +10599,18 @@ Lng32 SQLCLI_LOBddlInterface
   char * lobMDName = 
     ExpLOBoper::ExpGetLOBMDName(schNameLen, schName, objectUID,
                                lobMDNameBuf, lobMDNameLen);
-  
+  str_sprintf(logBuf,"lobMDName %s", lobMDName);
+  lobDebugInfo(logBuf,0,__LINE__,lobTrace);
   char * query = new(currContext.exHeap()) char[4096];
 
   switch (qType)
     {
     case LOB_CLI_CREATE:
       {
-       
        // create lob metadata table
        str_sprintf(query, "create ghost table %s (lobnum smallint not null, 
storagetype smallint not null, location varchar(4096) not null, primary key 
(lobnum)) ",lobMDName);
-       
+        lobDebugInfo(query,0,__LINE__,lobTrace);
+
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10589,6 +10630,7 @@ Lng32 SQLCLI_LOBddlInterface
            str_sprintf(query, "insert into table (ghost table %s) values (%d, 
%d, '%s')",
                        lobMDName, 
                        lobNumList[i], lobTypList[i], lobLocList[i]);
+            lobDebugInfo(query,0,__LINE__,lobTrace);
 
            // set parserflags to allow ghost table
            currContext.setSqlParserFlags(0x1);
@@ -10649,7 +10691,7 @@ Lng32 SQLCLI_LOBddlInterface
                                             NULL,
                                             NULL,
                                             NULL,
-                                            0);
+                                            0,lobTrace);
            if (cliRC < 0)
              {
                cliInterface->retrieveSQLDiagnostics(myDiags);
@@ -10666,7 +10708,8 @@ Lng32 SQLCLI_LOBddlInterface
       {
        str_sprintf(query, "drop ghost table %s",
                    lobMDName);
-       
+        lobDebugInfo(query,0,__LINE__,lobTrace);
+
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10722,7 +10765,7 @@ Lng32 SQLCLI_LOBddlInterface
                                             NULL,
                                             NULL,
                                             NULL,
-                                            0);
+                                            0,lobTrace);
            if (cliRC < 0)
              {
                cliInterface->retrieveSQLDiagnostics(myDiags);
@@ -10738,7 +10781,8 @@ Lng32 SQLCLI_LOBddlInterface
     case LOB_CLI_CLEANUP:
       {
        str_sprintf(query, "cleanup table %s", lobMDName);
-       
+        lobDebugInfo(query,0,__LINE__,lobTrace);
+
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);
        
@@ -10794,7 +10838,7 @@ Lng32 SQLCLI_LOBddlInterface
                                             NULL,
                                             NULL,
                                             NULL,
-                                            0);
+                                            0,lobTrace);
            if (cliRC < 0)
              {
                cliInterface->retrieveSQLDiagnostics(myDiags);
@@ -10813,9 +10857,11 @@ Lng32 SQLCLI_LOBddlInterface
         if (qType == LOB_CLI_SELECT_CURSOR)
           str_sprintf(query, "select lobnum, storagetype, location from 
table(ghost table %s) order by lobnum for read uncommitted access",
                       lobMDName);
+         
         else
           str_sprintf(query, "select lobnum, storagetype, location from 
table(ghost table %s) where lobnum = %d for read uncommitted access",
                       lobMDName, numLOBs);
+         lobDebugInfo(query,0,__LINE__,lobTrace);
 
        // set parserflags to allow ghost table
        currContext.setSqlParserFlags(0x1);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/cli/Cli.h
----------------------------------------------------------------------
diff --git a/core/sql/cli/Cli.h b/core/sql/cli/Cli.h
index db96c87..31f5bbc 100644
--- a/core/sql/cli/Cli.h
+++ b/core/sql/cli/Cli.h
@@ -907,7 +907,8 @@ Lng32 SQLCLI_LOBcliInterface
  /*OUT*/    Int64 * outDescPartnKey,  /* returned after insert and select */
  /*OUT*/    Int64 * outDescSyskey,    /* returned after insert and select */
  /*INOUT*/  void* *inCliInterface,
- /*IN*/     Int64 xnId          /* xn id of the parent process, if non-zero */
+ /*IN*/     Int64 xnId,          /* xn id of the parent process, if non-zero */
+ /*IN */    NABoolean lobTrace
  );
 Lng32 SQLCLI_LOB_GC_Interface
 (
@@ -918,7 +919,8 @@ Lng32 SQLCLI_LOB_GC_Interface
  /*IN*/     char*  hdfsServer,
  /*IN*/     Lng32  hdfsPort,
  /*IN*/     char *lobLocation,
- /*IN*/    Int64 lobMaxMemChunkLen // if passed in as 0, will use default 
value of 1G for the in memory buffer to do compaction.
+ /*IN*/    Int64 lobMaxMemChunkLen, // if passed in as 0, will use default 
value of 1G for the in memory buffer to do compaction.
+ /*IN*/    NABoolean lobTrace
  );
 
 Lng32 SQLCLI_LOBddlInterface
@@ -934,7 +936,8 @@ Lng32 SQLCLI_LOBddlInterface
  /*IN*/     char* *lobLocList,
  /*IN*/    char *hdfsServer,
  /*IN*/    Int32 hdfsPort,
- /*IN*/     Int64 lobMaxSize
+ /*IN*/     Int64 lobMaxSize,
+ /*IN*/    NABoolean lobTrace
  );
 
 Lng32 SQLCLI_LOBloader2sqlInterface

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/cli/CliExtern.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/CliExtern.cpp b/core/sql/cli/CliExtern.cpp
index e5dd796..e3e3995 100644
--- a/core/sql/cli/CliExtern.cpp
+++ b/core/sql/cli/CliExtern.cpp
@@ -7370,7 +7370,8 @@ SQLCLI_LIB_FUNC Lng32 SQL_EXEC_LOBcliInterface
  /*OUT*/    Int64 * outDescPartnKey,  /* returned after insert and select */
  /*OUT*/    Int64 * outDescSyskey,
  /*INOUT*/  void* *inCliInterface,
- /*IN*/     Int64 xnId          /* xn id of the parent process, if non-zero */
+ /*IN*/     Int64 xnId,          /* xn id of the parent process, if non-zero */
+ /*IN*/     NABoolean lobTrace
  )
 {
   Lng32 retcode;
@@ -7396,7 +7397,7 @@ SQLCLI_LIB_FUNC Lng32 SQL_EXEC_LOBcliInterface
                                       outDescPartnKey,
                                       outDescSyskey,
                                       inCliInterface,
-                                      xnId);
+                                      xnId,lobTrace);
     }
   catch(...)
     {
@@ -7423,7 +7424,8 @@ Lng32 SQL_EXEC_LOB_GC_Interface
  /*IN*/     char*  hdfsServer,
  /*IN*/     Lng32  hdfsPort,
  /*IN*/     char *lobLocation,
- /*IN*/    Int64 lobMaxMemChunkLen // if passed in as 0, will use default 
value of 1G for the in memory buffer to do compaction.
+ /*IN*/    Int64 lobMaxMemChunkLen, // if passed in as 0, will use default 
value of 1G for the in memory buffer to do compaction.
+ /*IN*/    NABoolean lobTrace
  )
 {
   Lng32 retcode;
@@ -7441,7 +7443,7 @@ Lng32 SQL_EXEC_LOB_GC_Interface
                                         handleLen,
                                         hdfsServer,
                                         hdfsPort,lobLocation,
-                                        lobMaxMemChunkLen);
+                                        lobMaxMemChunkLen,lobTrace);
     }
   catch(...)
     {
@@ -7473,7 +7475,8 @@ Lng32 SQL_EXEC_LOBddlInterface
  /*IN*/     char* *lobLocList,
  /*IN*/     char *hdfsServer,
  /*IN*/     Int32 hdfsPort,
- /*IN */    Int64 lobMaxSize
+ /*IN */    Int64 lobMaxSize,
+ /*IN*/     NABoolean lobTrace
  )
 {
   Lng32 retcode;
@@ -7496,7 +7499,8 @@ Lng32 SQL_EXEC_LOBddlInterface
                                       lobLocList,
                                        hdfsServer,
                                        hdfsPort, 
-                                       lobMaxSize);
+                                       lobMaxSize,
+                                       lobTrace);
     }
   catch(...)
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/cli/SessionDefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/SessionDefaults.cpp b/core/sql/cli/SessionDefaults.cpp
index bc5bd13..1ace070 100644
--- a/core/sql/cli/SessionDefaults.cpp
+++ b/core/sql/cli/SessionDefaults.cpp
@@ -842,6 +842,7 @@ static const AQRInfo::AQRErrorMap aqrErrorMap[] =
 
   AQREntry(   8606,     97,      1,     0,      5,   0, "",    0,     0),
 
+  AQREntry(   8606,     73,      3,     60,      0,   0, "",    0,     0),
   // privileges may have been revoked
   AQREntry(   8734,      0,      1,     0,      1,   0, "",    0,     0),
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index 66d175c..bc0c80c 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -1546,7 +1546,7 @@ RETCODE Statement::prepare2(char *source, ComDiagsArea 
&diagsArea,
       
       SQLMXLoggingArea::logSQLMXAbortEvent("Statement.cpp",888, "testing abort 
event");
       
SQLMXLoggingArea::logSQLMXAssertionFailureEvent("Statement.cpp",777,"testing 
assertion failure");
-      SQLMXLoggingArea::logSQLMXDebugEvent("debug event" ,69);
+      SQLMXLoggingArea::logSQLMXDebugEvent("debug event" ,69,__LINE__);
       
       SQLMXLoggingArea::logMVRefreshInfoEvent("mv refresh info");
       SQLMXLoggingArea::logMVRefreshErrorEvent("mv refresh error");

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/comexe/ComTdb.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdb.cpp b/core/sql/comexe/ComTdb.cpp
index 8408ec1..dc8e5c4 100644
--- a/core/sql/comexe/ComTdb.cpp
+++ b/core/sql/comexe/ComTdb.cpp
@@ -764,7 +764,13 @@ NA_EIDPROC char *ComTdb::findVTblPtrCom(short classID)
 #pragma warn(1506)  // warning elimination 
       break;
     }
-
+ case ex_LOB_INFO:
+    {
+#pragma nowarn(1506)   // warning elimination 
+      GetVTblPtr(vtblptr,ComTdbExeUtilLobInfo);
+#pragma warn(1506)  // warning elimination 
+      break;
+    }
    case ex_GET_METADATA_INFO:
     {
 #pragma nowarn(1506)   // warning elimination 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/comexe/ComTdb.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdb.h b/core/sql/comexe/ComTdb.h
index a7f7d25..689bded 100644
--- a/core/sql/comexe/ComTdb.h
+++ b/core/sql/comexe/ComTdb.h
@@ -288,6 +288,7 @@ public:
     ex_LONG_RUNNING = 116,
     ex_GET_METADATA_INFO = 117,
     ex_GET_VERSION_INFO  = 118,
+    ex_LOB_INFO =119,
     ex_SUSPEND_ACTIVATE  = 121,
     ex_DISK_LABEL_STATISTICS = 122,
     ex_REGION_STATS = 123,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/comexe/ComTdbExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.cpp 
b/core/sql/comexe/ComTdbExeUtil.cpp
index b1bc62a..3442714 100644
--- a/core/sql/comexe/ComTdbExeUtil.cpp
+++ b/core/sql/comexe/ComTdbExeUtil.cpp
@@ -2803,3 +2803,77 @@ ComTdbExeUtilRegionStats::ComTdbExeUtilRegionStats
 {
   setNodeType(ComTdb::ex_REGION_STATS);
 }
+
+ComTdbExeUtilLobInfo::ComTdbExeUtilLobInfo
+(
+     char * tableName,
+      Int64 objectUID,
+     Lng32 numLOBs,
+     char *lobColArray,
+     char * lobNumArray,
+     char * lobLocArray,
+     Int32 hdfsPort,
+     char *hdfsServer,
+     NABoolean tableFormat,
+     ex_cri_desc * work_cri_desc,
+     const unsigned short work_atp_index,
+     ex_cri_desc * given_cri_desc,
+     ex_cri_desc * returned_cri_desc,
+     queue_index down,
+     queue_index up,
+     Lng32 num_buffers,
+     ULng32 buffer_size)
+     : ComTdbExeUtil(ComTdbExeUtil::LOB_INFO_,
+                    NULL, 0, (Int16)SQLCHARSETCODE_UNKNOWN,
+                    tableName, strlen(tableName),
+                    NULL, 0,
+                    NULL, 0,
+                    NULL,
+                    work_cri_desc, work_atp_index,
+                    given_cri_desc, returned_cri_desc,
+                    down, up, 
+                    num_buffers, buffer_size),
+       flags_(0),
+       objectUID_(objectUID),
+       numLOBs_(numLOBs),
+       lobColArray_(lobColArray),
+       lobNumArray_(lobNumArray),
+       lobLocArray_(lobLocArray),
+       hdfsPort_(0),
+       hdfsServer_(hdfsServer),
+       tableFormat_(tableFormat)
+{
+  setNodeType(ComTdb::ex_LOB_INFO);
+}
+
+Long ComTdbExeUtilLobInfo::pack(void * space)
+{
+  if (lobColArray_) 
+    lobColArray_.pack(space);
+
+ if (lobNumArray_) 
+    lobNumArray_.pack(space);
+
+ if (lobLocArray_) 
+    lobLocArray_.pack(space);
+
+ if (hdfsServer_) 
+    hdfsServer_.pack(space);
+  return ComTdbExeUtil::pack(space);
+}
+
+Lng32 ComTdbExeUtilLobInfo::unpack(void * base, void * reallocator)
+{
+  if (lobColArray_.unpack(base))
+    return -1;
+
+  if(lobNumArray_.unpack(base)) 
+    return -1;
+
+  if(lobLocArray_.unpack(base)) 
+    return -1;
+
+  if(hdfsServer_.unpack(base)) 
+    return -1;
+  return ComTdbExeUtil::unpack(base, reallocator);
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/comexe/ComTdbExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbExeUtil.h b/core/sql/comexe/ComTdbExeUtil.h
index 7f95e4b..ea3ef69 100644
--- a/core/sql/comexe/ComTdbExeUtil.h
+++ b/core/sql/comexe/ComTdbExeUtil.h
@@ -74,6 +74,7 @@ public:
     GET_METADATA_INFO_       = 14,
     GET_VERSION_INFO_        = 15,
     SUSPEND_ACTIVATE_        = 16,
+    LOB_INFO_                = 17,
     SHOW_SET_                = 19,
     AQR_                     = 20,
     DISPLAY_EXPLAIN_COMPLEX_ = 21,
@@ -3580,6 +3581,127 @@ private:
   char fillersComTdbExeUtilRegionStats_[76];      // 04-79
 };
 
+
+
+// Lob info virtual table info
+static const ComTdbVirtTableColumnInfo comTdbLobInfoVirtTableColumnInfo[] =
+  {
+    { "CATALOG_NAME",                   0, COM_USER_COLUMN, REC_BYTE_F_ASCII,  
256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, 
"",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "SCHEMA_NAME",                    1, COM_USER_COLUMN, REC_BYTE_F_ASCII,  
256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, 
"",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "OBJECT_NAME",                    2, COM_USER_COLUMN, REC_BYTE_F_ASCII,  
256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, 
"",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "COLUMN_NAME",                     3, COM_USER_COLUMN, REC_BYTE_F_ASCII, 
 256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, 
"",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "LOB_LOCATION",                    4, COM_USER_COLUMN, REC_BYTE_F_ASCII, 
 256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, 
"",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "LOB_DATA_FILE",                     5, COM_USER_COLUMN, 
REC_BYTE_F_ASCII,    256, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, 
COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "LOB_DATA_FILE_SIZE_EOD",         6, COM_USER_COLUMN, REC_BIN64_SIGNED,  
  8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, 
"",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  },
+    { "LOB_DATA_FILE_SIZE_USED",                7, COM_USER_COLUMN, 
REC_BIN64_SIGNED,    8, FALSE, SQLCHARSETCODE_UTF8 , 0, 0, 0, 0, 0, 0, 0, 
COM_NO_DEFAULT, "",NULL,NULL, COM_UNKNOWN_DIRECTION_LIT, 0  }
+    
+  };
+
+#define LOBINFO_MAX_FILE_LEN 256
+struct ComTdbLobInfoVirtTableColumnStruct
+{
+  char   catalogName[LOBINFO_MAX_FILE_LEN];
+  char   schemaName[LOBINFO_MAX_FILE_LEN];
+  char   objectName[LOBINFO_MAX_FILE_LEN];
+  char   columnName[LOBINFO_MAX_FILE_LEN];
+  char   lobLocation[LOBINFO_MAX_FILE_LEN];
+  char   lobDataFile[LOBINFO_MAX_FILE_LEN];
+  Int64  lobDataFileSizeEod;
+  Int64  lobDataFileSizeUsed;
+};
+
+
+class ComTdbExeUtilLobInfo : public ComTdbExeUtil
+{
+  friend class ExExeUtilLobInfoTcb;
+  friend class ExExeUtilLobInfoTableTcb;
+  friend class ExExeUtilLobInfoPrivateState;
+
+public:
+  ComTdbExeUtilLobInfo()
+       : ComTdbExeUtil()
+  {}
+  Lng32 getNumLobs() { return numLOBs_;}
+  char *getLobColList(){return lobColArray_;}
+  char *getLobNumList() {return lobNumArray_;}
+  char *getLobLocList() {return lobLocArray_;}
+  Int64 getObjectUID() { return objectUID_;}
+  Int32 getHdfsPort() { return hdfsPort_;}
+  char *getHdfsServer() {return hdfsServer_;}
+  NABoolean isTableFormat() { return tableFormat_;}
+  ComTdbExeUtilLobInfo(
+       char * tableName,
+       Int64 objectUID,
+       Lng32 numLOBs,
+       char* lobColArray,
+       char* lobNumArray,
+       char* lobLocArray,
+       Int32 hdfsPort,
+       char *hdfsServer,
+       NABoolean tableFormat,
+       ex_cri_desc * work_cri_desc,
+       const unsigned short work_atp_index,
+       ex_cri_desc * given_cri_desc,
+       ex_cri_desc * returned_cri_desc,
+       queue_index down,
+       queue_index up,
+       Lng32 num_buffers,
+       ULng32 buffer_size
+       );
+  
+  
+
+  // ---------------------------------------------------------------------
+  // Redefine virtual functions required for Versioning.
+  //----------------------------------------------------------------------
+  virtual short getClassSize() {return 
(short)sizeof(ComTdbExeUtilRegionStats);}
+
+  virtual const char *getNodeName() const 
+  { 
+    return "GET_LOB_INFO";
+  };
+
+  static int getVirtTableNumCols()
+  {
+    return 
sizeof(comTdbLobInfoVirtTableColumnInfo)/sizeof(ComTdbVirtTableColumnInfo);
+  }
+
+  static ComTdbVirtTableColumnInfo * getVirtTableColumnInfo()
+  {
+    return (ComTdbVirtTableColumnInfo*)comTdbLobInfoVirtTableColumnInfo;
+  }
+
+  static int getVirtTableNumKeys()
+  {
+    return 0;
+  }
+
+  static ComTdbVirtTableKeyInfo * getVirtTableKeyInfo()
+  {
+    return NULL;
+  }
+  Long pack(void *);
+  Lng32 unpack(void *, void * reallocator);
+private:
+  UInt32 flags_;   
+  UInt16 numLOBs_;                                   
+  
+  //array fo strings - column names 
+  NABasicPtr lobColArray_;
+  // array of shorts. numLOBs entries. 
+  // Each entry is the lobNum.
+  NABasicPtr lobNumArray_;                           
+
+  // array of string, null terminated. numLOBs entries. 
+  // Each entry is the storage location of lob data file.
+  NABasicPtr lobLocArray_;                           
+  Int32 hdfsPort_;
+  NABasicPtr hdfsServer_;
+  Int64 objectUID_;                                                      
+
+  NABoolean tableFormat_;
+  
+};
 #endif
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/executor/ExComTdb.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExComTdb.cpp b/core/sql/executor/ExComTdb.cpp
index 54ce150..ad17627 100644
--- a/core/sql/executor/ExComTdb.cpp
+++ b/core/sql/executor/ExComTdb.cpp
@@ -489,6 +489,14 @@ NA_EIDPROC char *ComTdb::findVTblPtrExe(short classID)
 
       break;
     }
+case ex_LOB_INFO:
+    {
+#pragma nowarn(1506)   // warning elimination 
+      GetVTblPtr(vtblptr,ExExeUtilLobInfoTdb);
+#pragma warn(1506)  // warning elimination 
+
+      break;
+    }
   case ex_GET_METADATA_INFO:
     {
 #pragma nowarn(1506)   // warning elimination 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/executor/ExExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtil.h b/core/sql/executor/ExExeUtil.h
index 83cd817..d726a1f 100755
--- a/core/sql/executor/ExExeUtil.h
+++ b/core/sql/executor/ExExeUtil.h
@@ -3803,6 +3803,182 @@ public:
 protected:
 };
 
+
+//////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------
+// ExExeUtilLobInfoTdb
+// -----------------------------------------------------------------------
+class ExExeUtilLobInfoTdb : public ComTdbExeUtilLobInfo
+{
+public:
+
+  // ---------------------------------------------------------------------
+  // Constructor is only called to instantiate an object used for
+  // retrieval of the virtual table function pointer of the class while
+  // unpacking. An empty constructor is enough.
+  // ---------------------------------------------------------------------
+  NA_EIDPROC ExExeUtilLobInfoTdb()
+  {}
+
+  NA_EIDPROC virtual ~ExExeUtilLobInfoTdb()
+  {}
+
+  // ---------------------------------------------------------------------
+  // Build a TCB for this TDB. Redefined in the Executor project.
+  // ---------------------------------------------------------------------
+  NA_EIDPROC virtual ex_tcb *build(ex_globals *globals);
+
+private:
+  // ---------------------------------------------------------------------
+  // !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
+  // *********************************************************************
+  // The Executor TDB's are only used for the sole purpose of providing a
+  // way to supplement the Compiler TDB's (in comexe) with methods whose
+  // implementation depends on Executor objects. This is done so as to
+  // decouple the Compiler from linking in Executor objects unnecessarily.
+  //
+  // When a Compiler generated TDB arrives at the Executor, the same data
+  // image is "cast" as an Executor TDB after unpacking. Therefore, it is
+  // a requirement that a Compiler TDB has the same object layout as its
+  // corresponding Executor TDB. As a result of this, all Executor TDB's
+  // must have absolutely NO data members, but only member functions. So,
+  // if you reach here with an intention to add data members to a TDB, ask
+  // yourself two questions:
+  //
+  // 1. Are those data members Compiler-generated?
+  //    If yes, put them in the ComTdbDLL instead.
+  //    If no, they should probably belong to someplace else (like TCB).
+  // 
+  // 2. Are the classes those data members belong defined in the executor
+  //    project?
+  //    If your answer to both questions is yes, you might need to move
+  //    the classes to the comexe project.
+  // ---------------------------------------------------------------------
+};
+
+//////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------
+// ExExeUtilLobInfoTcb
+// -----------------------------------------------------------------------
+class ExExeUtilLobInfoTcb : public ExExeUtilTcb
+{
+  friend class ExExeUtilLobInfoTdb;
+  friend class ExExeUtilPrivateState;
+
+public:
+  // Constructor
+  ExExeUtilLobInfoTcb(const ComTdbExeUtilLobInfo & exe_util_tdb,
+                               ex_globals * glob = 0);
+
+  ~ExExeUtilLobInfoTcb();
+
+  virtual short work();
+
+
+private:
+  enum Step
+  {
+    INITIAL_,
+    EVAL_INPUT_,
+    COLLECT_LOBINFO_,
+    POPULATE_LOBINFO_BUF_,
+    RETURN_LOBINFO_BUF_,
+    HANDLE_ERROR_,
+    DONE_
+  };
+  Step step_;
+
+protected:
+ 
+  short collectAndReturnLobInfo(char * tableName, Int32 currLobNum, ContextCli 
*context);
+
+  ExExeUtilLobInfoTdb & getLItdb() const
+  {
+    return (ExExeUtilLobInfoTdb &) tdb;
+  };
+  
+  char * tableName_;
+  char * inputNameBuf_;
+  Int32 currLobNum_;
+ 
+};
+
+//////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------
+// ExExeUtilLobInfoTableTcb
+// -----------------------------------------------------------------------
+class ExExeUtilLobInfoTableTcb : public ExExeUtilTcb
+{
+  friend class ExExeUtilLobInfoTdb;
+  friend class ExExeUtilPrivateState;
+
+public:
+  // Constructor
+  ExExeUtilLobInfoTableTcb(const ComTdbExeUtilLobInfo & exe_util_tdb,
+                               ex_globals * glob = 0);
+
+  ~ExExeUtilLobInfoTableTcb();
+
+  virtual short work();
+
+
+private:
+  enum Step
+  {
+    INITIAL_,
+    EVAL_INPUT_,
+    COLLECT_LOBINFO_,
+    POPULATE_LOBINFO_BUF_,
+    RETURN_LOBINFO_BUF_,
+    HANDLE_ERROR_,
+    DONE_
+  };
+  Step step_;
+
+protected:
+  Int64 getEmbeddedNumValue(char* &sep, char endChar, 
+                            NABoolean adjustLen = TRUE);
+  short collectLobInfo(char * tableName, Int32 currLobNum, ContextCli 
*context);
+  short populateLobInfo(Int32 currLobNum, NABoolean nullTerminate = FALSE);
+
+  ExExeUtilLobInfoTdb & getLItdb() const
+  {
+    return (ExExeUtilLobInfoTdb &) tdb;
+  };
+ 
+  char * tableName_;
+  char * inputNameBuf_;
+  
+  char * lobInfoBuf_;
+  Lng32 lobInfoBufLen_;
+  ComTdbLobInfoVirtTableColumnStruct* lobInfo_;  
+  Int32 currLobNum_;
+ 
+};
+
+
+////////////////////////////////////////////////////////////////////////////
+class ExExeUtilLobInfoPrivateState : public ex_tcb_private_state
+{
+  friend class ExExeUtilLobInfoTcb;
+  
+public:        
+  ExExeUtilLobInfoPrivateState();
+  ~ExExeUtilLobInfoPrivateState();     // destructor
+protected:
+};
+
+////////////////////////////////////////////////////////////////////////////
+class ExExeUtilLobInfoTablePrivateState : public ex_tcb_private_state
+{
+  friend class ExExeUtilLobInfoTableTcb;
+  
+public:        
+  ExExeUtilLobInfoTablePrivateState();
+  ~ExExeUtilLobInfoTablePrivateState();        // destructor
+protected:
+};
+
 #endif
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilGet.cpp 
b/core/sql/executor/ExExeUtilGet.cpp
index ae71016..94c09bf 100644
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@ -65,7 +65,7 @@
 
 #include "ExpHbaseInterface.h"
 #include "sql_buffer_size.h"
-
+#include "hdfs.h"
 
//******************************************************************************
 //                                                                             
*
 //  These definitions were stolen from CatWellKnownTables.h
@@ -6116,4 +6116,588 @@ short ExExeUtilRegionStatsFormatTcb::work()
   return WORK_OK;
 }
 
+
+///////////////////////////////////////////////////////////////////
+ex_tcb * ExExeUtilLobInfoTdb::build(ex_globals * glob)
+{
+
+  if (isTableFormat())
+    {
+      ExExeUtilLobInfoTableTcb *exe_util_tcb = new(glob->getSpace()) 
ExExeUtilLobInfoTableTcb(*this,glob);
+      exe_util_tcb->registerSubtasks();
+
+      return (exe_util_tcb);
+    }
+  else
+    {
+
+
+    ExExeUtilLobInfoTcb *exe_util_tcb = new(glob->getSpace()) 
ExExeUtilLobInfoTcb(*this, glob);
+    exe_util_tcb->registerSubtasks();
+
+    return (exe_util_tcb);
+    }
+ 
+}
+
+////////////////////////////////////////////////////////////////
+// Constructor for class ExExeUtilLobInfoTcb
+///////////////////////////////////////////////////////////////
+ExExeUtilLobInfoTcb::ExExeUtilLobInfoTcb(
+     const ComTdbExeUtilLobInfo & exe_util_tdb,
+     ex_globals * glob)
+     : ExExeUtilTcb( exe_util_tdb, NULL, glob)
+{
+  
+
+  inputNameBuf_ = NULL;
+  if (exe_util_tdb.inputExpr_)
+    {
+      inputNameBuf_ = new(glob->getDefaultHeap()) 
char[exe_util_tdb.inputRowlen_];
+    }
+
+  tableName_ = new(glob->getDefaultHeap()) char[2000];
+  currLobNum_ = 1;
+  step_ = INITIAL_;
+}
+
+ExExeUtilLobInfoTcb::~ExExeUtilLobInfoTcb()
+{
+  if (tableName_)
+    NADELETEBASIC(tableName_, getGlobals()->getDefaultHeap());
+  if(inputNameBuf_) 
+     NADELETEBASIC(inputNameBuf_, getGlobals()->getDefaultHeap());
+ 
+  tableName_ = NULL;
+  inputNameBuf_ = NULL;
+}
+
+short ExExeUtilLobInfoTcb::collectAndReturnLobInfo(char * tableName,Int32 
currLobNum, ContextCli *currContext)
+{
+  char *catName = NULL;
+  char *schName = NULL;
+  char *objName = NULL;
+  Int32 offset = 0;
+  char columnName[LOBINFO_MAX_FILE_LEN]= {'\0'};
+  char lobLocation[LOBINFO_MAX_FILE_LEN]={'\0'};
+  char lobDataFilePath[LOBINFO_MAX_FILE_LEN]={'\0'};
+  Int64 lobEOD=0;
+
+  char buf[1000];
+  short rc = 0;
+  if (isUpQueueFull(5))
+    {
+      return WORK_CALL_AGAIN; // come back later
+    }
+  
+
+  // populate catName, schName, objName.
+  if (extractParts(tableName,
+                   &catName, &schName, &objName))
+    {
+      return -1;
+    }
+  str_pad(buf,1000,' ');
+  //column name
+  offset = (currLobNum-1)*LOBINFO_MAX_FILE_LEN; 
+  strcpy(columnName, &((getLItdb().getLobColList())[offset]));
+  removeTrailingBlanks(columnName, LOBINFO_MAX_FILE_LEN);
+  str_sprintf(buf, "  ColumnName :  %s", columnName);
+  if (moveRowToUpQueue(buf, strlen(buf), &rc))
+    return rc;
+
+  //lob location  
+  strcpy(lobLocation, &((getLItdb().getLobLocList())[offset]));
+  removeTrailingBlanks(lobLocation, LOBINFO_MAX_FILE_LEN);
+  str_sprintf(buf, "  Lob Location :  %s", lobLocation);
+  if (moveRowToUpQueue(buf, strlen(buf), &rc))
+    return rc;      
+                 
+  // lobDataFile
+  char tgtLobNameBuf[256];
+  char *lobDataFile = 
+    ExpLOBoper::ExpGetLOBname
+    (getLItdb().objectUID_, currLobNum, 
+     tgtLobNameBuf, 256);
+ 
+  removeTrailingBlanks(lobDataFile, LOBINFO_MAX_FILE_LEN);
+  str_sprintf(buf, "  LOB Data File:  %s", lobDataFile);
+  if (moveRowToUpQueue(buf, strlen(buf), &rc))
+    return rc;  
+                
+  //EOD of LOB data file
+  hdfsFS fs = 
hdfsConnect((char*)getLItdb().getHdfsServer(),getLItdb().getHdfsPort());
+  if (fs == NULL)
+    return LOB_DATA_FILE_OPEN_ERROR;
+
+  snprintf(lobDataFilePath, LOBINFO_MAX_FILE_LEN, "%s/%s", lobLocation, 
lobDataFile);
+  hdfsFile fdData = hdfsOpenFile(fs, lobDataFilePath,O_RDONLY,0,0,0);
+  if (!fdData) 
+    {
+      hdfsCloseFile(fs,fdData);
+      fdData = NULL;
+      return LOB_DATA_FILE_OPEN_ERROR;
+    }
+  hdfsFileInfo *fInfo = hdfsGetPathInfo(fs, lobDataFilePath);
+  if (fInfo)
+    lobEOD = fInfo->mSize;
+ 
+  
+  str_sprintf(buf, "  LOB EOD :  %Ld", lobEOD);
+  if (moveRowToUpQueue(buf, strlen(buf), &rc))
+    return rc;
+
+  // Sum of all the lobDescChunks for used space
+
+  char lobDescChunkFileBuf[512];
+  //Get the descriptor chunks table name
+  char *lobDescChunksFile =
+    ExpLOBoper::ExpGetLOBDescChunksName(strlen(schName),schName,
+                                        getLItdb().objectUID_, currLobNum, 
+                                        lobDescChunkFileBuf, 512);
+ 
+  char *query = new(getGlobals()->getDefaultHeap()) char[4096];
+  str_sprintf (query,  "select sum(chunklen) from  %s ", lobDescChunksFile);
+
+  // set parserflags to allow ghost table
+  currContext->setSqlParserFlags(0x1);
+       
+
+  Int64 outlen = 0;Lng32 len = 0;
+  Int32 cliRC = cliInterface()->executeImmediate(query,(char *)&outlen, &len, 
FALSE);
+  NADELETEBASIC(query, getGlobals()->getDefaultHeap());
+  currContext->resetSqlParserFlags(0x1);
+  if (cliRC <0 )
+    {
+      return cliRC;
+    }
+
+  str_sprintf(buf, "  LOB Used Len :  %Ld", outlen);
+  if (moveRowToUpQueue(buf, strlen(buf), &rc))
+    return rc;
+  return 0;
+}
+short ExExeUtilLobInfoTcb::work()
+{
+  short retcode = 0;
+  Lng32 cliRC = 0;
+   const char *parentQid = NULL;
+  char buf[1000];
+     short rc = 0;
+  // if no parent request, return
+  if (qparent_.down->isEmpty())
+    return WORK_OK;
+  
+  // if no room in up queue, won't be able to return data/status.
+  // Come back later.
+  if (qparent_.up->isFull())
+    return WORK_OK;
+  
+  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
+  ExExeUtilPrivateState & pstate =
+    *((ExExeUtilPrivateState*) pentry_down->pstate);
+
+  // Get the globals stucture of the master executor.
+  ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
+  ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
+  ContextCli * currContext = masterGlob->getCliGlobals()->currContext();
+   ExExeStmtGlobals *stmtGlobals = getGlobals()->castToExExeStmtGlobals();
+  while (1)
+    {
+      switch (step_)
+       {
+       case INITIAL_:
+         {
+            if (isUpQueueFull(3))
+             {
+               return WORK_CALL_AGAIN; // come back later
+             }
+           
+             
+            if (getLItdb().inputExpr())
+              {
+                step_ = EVAL_INPUT_;
+                break;
+              }
+
+            strcpy(tableName_, getLItdb().getTableName());
+            str_pad(buf,1000,'\0');
+            str_sprintf(buf, " ");
+           if (moveRowToUpQueue(buf, strlen(buf), &rc))
+              return rc;
+            removeTrailingBlanks(tableName_, LOBINFO_MAX_FILE_LEN);
+            str_pad(buf,1000,'\0');
+            str_sprintf(buf, "Lob Information for table: %s", tableName_);
+            if (moveRowToUpQueue(buf, strlen(buf), &rc))
+              return rc;
+            str_pad(buf,1000,'\0');
+             str_sprintf(buf, "=========================");
+            if (moveRowToUpQueue(buf, strlen(buf), &rc))
+              return rc;
+            str_pad(buf,1000,'\0');
+            str_sprintf(buf, " ");
+           if (moveRowToUpQueue(buf, strlen(buf), &rc))
+             return rc;
+            
+           step_ = COLLECT_LOBINFO_;
+           
+         }
+       break;
+
+        case EVAL_INPUT_:
+          {
+           workAtp_->getTupp(getLItdb().workAtpIndex())
+             .setDataPointer(inputNameBuf_);
+
+           ex_expr::exp_return_type exprRetCode =
+             getLItdb().inputExpr()->eval(pentry_down->getAtp(), workAtp_);
+           if (exprRetCode == ex_expr::EXPR_ERROR)
+             {
+               step_ = HANDLE_ERROR_;
+               break;
+             }
+
+            short len = *(short*)inputNameBuf_;
+            str_cpy_all(tableName_, &inputNameBuf_[2], len);
+            tableName_[len] = 0;
+
+           
+            step_ = COLLECT_LOBINFO_;
+          }
+          break;
+
+        case COLLECT_LOBINFO_:
+          {
+            if (getLItdb().getNumLobs() == 0)
+              {
+                str_sprintf(buf, "  Num Lob Columns = 0", tableName_);
+                if (moveRowToUpQueue(buf, strlen(buf), &rc))
+                  return rc;
+                step_ = DONE_;
+                break;
+              }
+            if (currLobNum_ == getLItdb().getNumLobs()+1)
+              {
+                step_ = DONE_;
+                break;
+              }
+            if (collectAndReturnLobInfo(tableName_,currLobNum_, currContext))
+              {
+                step_ = HANDLE_ERROR_;
+                break;
+              }
+            currLobNum_++;
+            
+          }
+          break;
+
+
+
+       case HANDLE_ERROR_:
+         {
+           retcode = handleError();
+           if (retcode == 1)
+             return WORK_OK;
+           
+           step_ = DONE_;
+         }
+       break;
+       
+       case DONE_:
+         {
+           
+           retcode = handleDone();
+           if (retcode == 1)
+             return WORK_OK;
+           
+           step_ = INITIAL_;
+           
+           return WORK_OK;
+         }
+       break;
+
+
+       } // switch
+
+    } // while
+
+  return WORK_OK;
+}
+//LCOV_EXCL_STOP
+
+
+
+////////////////////////////////////////////////////////////////
+// Constructor for class ExExeUtilLobInfoTableTcb
+///////////////////////////////////////////////////////////////
+ExExeUtilLobInfoTableTcb::ExExeUtilLobInfoTableTcb(
+     const ComTdbExeUtilLobInfo & exe_util_tdb,
+     ex_globals * glob)
+     : ExExeUtilTcb( exe_util_tdb, NULL, glob)
+{
+  lobInfoBuf_ = new(glob->getDefaultHeap()) 
char[sizeof(ComTdbLobInfoVirtTableColumnStruct)];
+  lobInfoBufLen_ = sizeof(ComTdbLobInfoVirtTableColumnStruct);
+
+  lobInfo_ = (ComTdbLobInfoVirtTableColumnStruct*)lobInfoBuf_;
+
+  inputNameBuf_ = NULL;
+  if (exe_util_tdb.inputExpr_)
+    {
+      inputNameBuf_ = new(glob->getDefaultHeap()) 
char[exe_util_tdb.inputRowlen_];
+    }
+
+  
+  tableName_ = new(glob->getDefaultHeap()) char[2000];
+  currLobNum_ = 1;
+  step_ = INITIAL_;
+}
+
+ExExeUtilLobInfoTableTcb::~ExExeUtilLobInfoTableTcb()
+{
+  if (lobInfoBuf_)
+    NADELETEBASIC(lobInfoBuf_, getGlobals()->getDefaultHeap());
+  if (tableName_)
+    NADELETEBASIC(tableName_, getGlobals()->getDefaultHeap());
+  if(inputNameBuf_) 
+     NADELETEBASIC(inputNameBuf_, getGlobals()->getDefaultHeap());
+
+  tableName_ = NULL;
+  inputNameBuf_ = NULL;
+
+  lobInfoBuf_ = NULL;
+}
+short ExExeUtilLobInfoTableTcb:: populateLobInfo(Int32 currIndex, NABoolean 
nullTerminate )
+{
+  return 0;
+}
+short ExExeUtilLobInfoTableTcb::collectLobInfo(char * tableName,Int32 
currLobNum, ContextCli *currContext)
+{
+  char *catName = NULL;
+  char *schName = NULL;
+  char *objName = NULL;
+  Int32 offset = 0;
+  char columnName[LOBINFO_MAX_FILE_LEN]= {'\0'};
+  char lobDataFilePath[LOBINFO_MAX_FILE_LEN]={'\0'};
+  Int64 lobEOD=0;
+
+  // populate catName, schName, objName.
+  if (extractParts(tableName,
+                   &catName, &schName, &objName))
+    {
+      return -1;
+    }
+  str_pad((char *)lobInfo_,sizeof(ComTdbLobInfoVirtTableColumnStruct),' ');
+  
+  str_cpy_all(lobInfo_->catalogName,catName,strlen(catName));
+  str_cpy_all(lobInfo_->schemaName,schName,strlen(schName));
+  str_cpy_all(lobInfo_->objectName,objName,strlen(objName));
+
+  //column name
+  offset = (currLobNum-1)*LOBINFO_MAX_FILE_LEN; 
+  str_cpy_all(lobInfo_->columnName, &((getLItdb().getLobColList())[offset]),
+              strlen(&((getLItdb().getLobColList())[offset])));
+  
+  //lob location  
+  char *lobLocation = &((getLItdb().getLobLocList())[offset]);
+  str_cpy_all(lobInfo_->lobLocation, lobLocation, strlen(lobLocation));
+                          
+  // lobDataFile
+  char tgtLobNameBuf[256];
+  char *lobDataFile = 
+             ExpLOBoper::ExpGetLOBname
+             (getLItdb().objectUID_, currLobNum, 
+              tgtLobNameBuf, 256);
+  str_cpy_all(lobInfo_->lobDataFile,  lobDataFile,strlen(lobDataFile));        
     
+  //EOD of LOB data file
+  hdfsFS fs = hdfsConnect(getLItdb().getHdfsServer(),getLItdb().getHdfsPort());
+  if (fs == NULL)
+    return LOB_DATA_FILE_OPEN_ERROR;
+
+  snprintf(lobDataFilePath, LOBINFO_MAX_FILE_LEN, "%s/%s", lobLocation, 
lobDataFile);
+  hdfsFile fdData = hdfsOpenFile(fs, lobDataFilePath,O_RDONLY,0,0,0);
+   if (!fdData) 
+    {
+      hdfsCloseFile(fs,fdData);
+      fdData = NULL;
+      return LOB_DATA_FILE_OPEN_ERROR;
+    }
+      hdfsFileInfo *fInfo = hdfsGetPathInfo(fs, lobDataFilePath);
+       if (fInfo)
+         lobEOD = fInfo->mSize;
+       lobInfo_->lobDataFileSizeEod=lobEOD;
+  // Sum of all the lobDescChunks for used space
+
+       char lobDescChunkFileBuf[52];
+  //Get the descriptor chunks table name
+       char *lobDescChunksFile =
+       ExpLOBoper::ExpGetLOBDescChunksName(strlen(schName),schName,
+                                        getLItdb().objectUID_, currLobNum, 
+                                        lobDescChunkFileBuf, 512);
+       char query[4096];
+       str_sprintf (query,  "select sum(chunklen) from  %s ", 
lobDescChunksFile);
+
+       // set parserflags to allow ghost table
+       currContext->setSqlParserFlags(0x1);
+       
+
+       Int64 outlen = 0;Lng32 len = 0;
+       Int32 cliRC = cliInterface()->executeImmediate(query,(char *)&outlen, 
&len, FALSE);
+        lobInfo_->lobDataFileSizeUsed = outlen;
+        currContext->resetSqlParserFlags(0x1);
+        if (cliRC <0 )
+          {
+            return cliRC;
+          }
+  
+   return 0;
+}
+short ExExeUtilLobInfoTableTcb::work()
+{
+  short retcode = 0;
+  Lng32 cliRC = 0;
+  const char *parentQid = NULL;
+  // if no parent request, return
+  if (qparent_.down->isEmpty())
+    return WORK_OK;
+  
+  // if no room in up queue, won't be able to return data/status.
+  // Come back later.
+  if (qparent_.up->isFull())
+    return WORK_OK;
+  
+  ex_queue_entry * pentry_down = qparent_.down->getHeadEntry();
+  ExExeUtilPrivateState & pstate =
+    *((ExExeUtilPrivateState*) pentry_down->pstate);
+
+  // Get the globals stucture of the master executor.
+  ExExeStmtGlobals *exeGlob = getGlobals()->castToExExeStmtGlobals();
+  ExMasterStmtGlobals *masterGlob = exeGlob->castToExMasterStmtGlobals();
+  ContextCli * currContext = masterGlob->getCliGlobals()->currContext();
+  
+  ExExeStmtGlobals *stmtGlobals = getGlobals()->castToExExeStmtGlobals();
+  if (stmtGlobals->castToExMasterStmtGlobals())
+    parentQid = stmtGlobals->castToExMasterStmtGlobals()->
+      getStatement()->getUniqueStmtId();
+  else 
+  {
+    ExEspStmtGlobals *espGlobals = stmtGlobals->castToExEspStmtGlobals();
+    if (espGlobals && espGlobals->getStmtStats())
+      parentQid = espGlobals->getStmtStats()->getQueryId();
+  }
+  ExeCliInterface cliInterface(getHeap(), NULL, NULL, parentQid);
+  while (1)
+    {
+      switch (step_)
+       {
+       case INITIAL_:
+         {
+           
+            if (getLItdb().inputExpr())
+              {
+                step_ = EVAL_INPUT_;
+                break;
+              }
+
+            strcpy(tableName_, getLItdb().getTableName());
+
+           step_ = COLLECT_LOBINFO_;
+         }
+       break;
+
+        case EVAL_INPUT_:
+          {
+           workAtp_->getTupp(getLItdb().workAtpIndex())
+             .setDataPointer(inputNameBuf_);
+
+           ex_expr::exp_return_type exprRetCode =
+             getLItdb().inputExpr()->eval(pentry_down->getAtp(), workAtp_);
+           if (exprRetCode == ex_expr::EXPR_ERROR)
+             {
+               step_ = HANDLE_ERROR_;
+               break;
+             }
+
+            short len = *(short*)inputNameBuf_;
+            str_cpy_all(tableName_, &inputNameBuf_[2], len);
+            tableName_[len] = 0;
+
+            step_ = COLLECT_LOBINFO_;
+          }
+          break;
+
+        case COLLECT_LOBINFO_:
+          {
+            if (currLobNum_ == getLItdb().getNumLobs()+1)
+              {
+                step_ = DONE_;
+                break;
+              }
+            if (collectLobInfo(tableName_,currLobNum_, currContext))
+              {
+                step_ = HANDLE_ERROR_;
+                break;
+              }
+
+            step_ = POPULATE_LOBINFO_BUF_;
+          }
+          break;
+
+       case POPULATE_LOBINFO_BUF_:
+         {
+            
+            
+            if (populateLobInfo(currLobNum_))
+              {
+                step_ = HANDLE_ERROR_;
+                break;
+                }
+
+           step_ = RETURN_LOBINFO_BUF_;
+         }
+       break;
+
+       case RETURN_LOBINFO_BUF_:
+         {
+           if (qparent_.up->isFull())
+             return WORK_OK;
+
+           short rc = 0;
+           if (moveRowToUpQueue((char*)lobInfo_, lobInfoBufLen_, &rc, FALSE))
+             return rc;
+
+            currLobNum_++;
+
+            step_ = COLLECT_LOBINFO_;
+         }
+       break;
+
+       case HANDLE_ERROR_:
+         {
+           retcode = handleError();
+           if (retcode == 1)
+             return WORK_OK;
+           
+           step_ = DONE_;
+         }
+       break;
+       
+       case DONE_:
+         {
+           retcode = handleDone();
+           if (retcode == 1)
+             return WORK_OK;
+           
+           step_ = INITIAL_;
+           
+           return WORK_CALL_AGAIN;
+         }
+       break;
+
+
+       } // switch
+
+    } // while
+
+  return WORK_OK;
+}
 //LCOV_EXCL_STOP

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bbe87c92/core/sql/executor/ExExeUtilLoad.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilLoad.cpp 
b/core/sql/executor/ExExeUtilLoad.cpp
index cc481a2..a9a1a55 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -2925,7 +2925,7 @@ short ExExeUtilLobExtractTcb::work()
           
                //Retrieve the total length of this lob using the handle info 
and return to the caller
                Int64 dummy = 0;
-               cliRC = SQL_EXEC_LOBcliInterface(lobHandle_, 
lobHandleLen_,NULL,NULL,NULL,NULL,LOB_CLI_SELECT_LOBLENGTH,LOB_CLI_ExecImmed, 
0,&lobDataLen_, &dummy, &dummy,0,0);
+               cliRC = SQL_EXEC_LOBcliInterface(lobHandle_, 
lobHandleLen_,NULL,NULL,NULL,NULL,LOB_CLI_SELECT_LOBLENGTH,LOB_CLI_ExecImmed, 
0,&lobDataLen_, &dummy, &dummy,0,0,FALSE);
                if (cliRC < 0)
                   {
                     getDiagsArea()->mergeAfter(diags);
@@ -2981,7 +2981,7 @@ short ExExeUtilLobExtractTcb::work()
               lobNumList,
               lobTypList,
               lobLocList,lobTdb().getLobHdfsServer(),
-               lobTdb().getLobHdfsPort(),0);
+               lobTdb().getLobHdfsPort(),0,FALSE);
            if (cliRC < 0)
              {
                getDiagsArea()->mergeAfter(diags);

Reply via email to