You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2015/09/25 23:13:20 UTC
[07/13] incubator-trafodion git commit: Merge remote branch
'origin/master' into lob_work_files2
Merge remote branch 'origin/master' into lob_work_files2
Conflicts:
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/85f1b7c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/85f1b7c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/85f1b7c2
Branch: refs/heads/master
Commit: 85f1b7c23a2d6974c0bc42cecdad363a9dc8d144
Parents: c76e38c c5c516e
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Mon Aug 31 05:58:24 2015 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Mon Aug 31 05:58:24 2015 +0000
----------------------------------------------------------------------
core/sql/bin/SqlciErrors.txt | 7 +-
core/sql/cli/SessionDefaults.cpp | 3 -
core/sql/cli/SessionDefaults.h | 9 -
core/sql/cli/Statement.cpp | 7 +-
core/sql/comexe/ComTdb.h | 5 +-
core/sql/common/ComMisc.cpp | 14 +
core/sql/common/ComMisc.h | 5 +
core/sql/common/ComObjectName.h | 47 +
core/sql/common/ComSmallDefs.cpp | 4 +-
core/sql/common/ComSmallDefs.h | 23 +-
core/sql/common/OperTypeEnum.h | 2 -
core/sql/executor/ExExplain.cpp | 9 +
core/sql/executor/ExHbaseIUD.cpp | 41 +-
core/sql/executor/ExHdfsScan.cpp | 115 ++-
core/sql/executor/ExHdfsScan.h | 45 +
core/sql/executor/ex_control.cpp | 7 -
core/sql/exp/ExpLOBaccess.cpp | 3 +
core/sql/exp/ExpLOBinterface.cpp | 3 +
core/sql/generator/GenExpGenerator.cpp | 6 +-
core/sql/generator/GenExpGenerator.h | 3 +-
core/sql/generator/GenPreCode.cpp | 18 +-
core/sql/generator/GenRelScan.cpp | 6 +-
core/sql/generator/GenRelUpdate.cpp | 12 +-
core/sql/generator/Generator.cpp | 2 +
core/sql/optimizer/BindRelExpr.cpp | 41 +-
core/sql/optimizer/ItemExpr.cpp | 5 +-
core/sql/optimizer/NATable.cpp | 169 +--
core/sql/optimizer/NATable.h | 19 +-
core/sql/optimizer/ObjectNames.h | 29 +-
core/sql/optimizer/RelExeUtil.cpp | 49 +-
core/sql/optimizer/SearchKey.cpp | 64 ++
core/sql/optimizer/SearchKey.h | 20 +-
core/sql/optimizer/SimpleScanOptimizer.cpp | 23 +-
core/sql/optimizer/disjuncts.h | 8 +-
core/sql/optimizer/mdam.cpp | 40 +-
core/sql/parser/AllElemDDL.h | 1 -
core/sql/parser/ElemDDLIndexPopulateOption.h | 6 +-
core/sql/parser/ElemDDLNode.cpp | 18 -
core/sql/parser/ElemDDLNode.h | 6 -
core/sql/parser/ElemDDLPartition.cpp | 54 -
core/sql/parser/ElemDDLPartitionSystem.h | 69 --
core/sql/parser/ParAll.cpp | 1 -
core/sql/parser/SqlParserAux.cpp | 83 ++
core/sql/parser/SqlParserAux.h | 65 ++
core/sql/parser/StmtDDLCreate.cpp | 135 ---
core/sql/parser/StmtDDLCreateIndex.h | 46 -
core/sql/parser/StmtDDLCreateTable.h | 89 +-
core/sql/parser/StmtDDLNode.h | 11 +-
core/sql/parser/sqlparser.y | 410 +++-----
core/sql/regress/catman1/EXPECTED135 | 8 +-
core/sql/regress/compGeneral/DIFF042.KNOWN.SB | 14 -
core/sql/regress/compGeneral/EXPECTED042 | 41 +-
core/sql/regress/compGeneral/EXPECTED071 | 8 +-
core/sql/regress/executor/EXPECTED106 | 1074 ++++++++++----------
core/sql/regress/executor/EXPECTED130 | 409 +++++++-
core/sql/regress/executor/TEST106 | 270 ++---
core/sql/regress/executor/TEST130 | 301 +++++-
core/sql/regress/hive/EXPECTED009 | 275 +++++
core/sql/regress/hive/EXPECTED015 | 83 +-
core/sql/regress/hive/TEST009 | 106 ++
core/sql/regress/hive/TEST009_a.hive.sql | 64 ++
core/sql/regress/hive/TEST015 | 3 -
core/sql/regress/seabase/EXPECTED010 | 379 +++----
core/sql/sqlcat/desc.h | 1 +
core/sql/sqlcomp/CmpDDLCatErrorCodes.h | 4 +-
core/sql/sqlcomp/CmpDescribe.cpp | 25 +-
core/sql/sqlcomp/CmpSeabaseDDL.h | 24 +-
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 126 ++-
core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 11 +-
core/sql/sqlcomp/CmpSeabaseDDLmd.h | 10 +
core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp | 46 +-
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 592 ++++++++---
core/sql/sqlcomp/CmpSeabaseDDLutil.cpp | 3 +-
core/sql/sqlcomp/CmpSeabaseDDLview.cpp | 40 +-
core/sql/sqlcomp/DefaultConstants.h | 1 +
core/sql/sqlcomp/PrivMgrMD.cpp | 8 +-
core/sql/sqlcomp/nadefaults.cpp | 5 +-
install/installer/traf_add_user | 6 +-
install/installer/traf_cloudera_mods98 | 2 +-
install/installer/traf_config_setup | 5 +-
install/installer/traf_setup | 2 +-
install/installer/trafodion_install | 40 +-
82 files changed, 3719 insertions(+), 2124 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------
diff --cc core/sql/exp/ExpLOBaccess.cpp
index 978ad5e,13913df..f2c5c02
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@@ -1537,7 -1504,7 +1537,8 @@@ Ex_Lob_Error ExLob::readCursorData(cha
operLen += bytesRead;
tgt += bytesRead;
}
-
+ hdfsCloseFile(fs_, fdData_);
++ fdData_ = NULL;
return LOB_OPER_OK;
}
@@@ -1635,281 -1654,148 +1636,283 @@@ Ex_Lob_Error ExLob::readDataToMem(char
openFlags_ = O_RDONLY;
fdData_ = hdfsOpenFile(fs_, lobDataFile_, openFlags_, 0, 0, 0);
if (!fdData_) {
- openFlags_ = -1;
- return LOB_DATA_FILE_OPEN_ERROR;
+ openFlags_ = -1;
+ return LOB_DATA_FILE_OPEN_ERROR;
+ }
+ }
+ else
+ {
+ fdData_ = hdfsOpenFile(fs_, lobDataFile_, openFlags_, 0, 0, 0);
+ if (!fdData_) {
+ openFlags_ = -1;
+ return LOB_DATA_FILE_OPEN_ERROR;
+ }
+ }
+
+ if (!multipleChunks)
+ {
+ if ((bytesRead = hdfsPread(fs_, fdData_, offset,
+ memAddr, size)) == -1) {
+
+ return LOB_DATA_READ_ERROR;
}
- }
- bytesRead = hdfsPread(fs_, fdData_, 0, memAddr, len);
-#else
- bytesRead = pread(fdData_, memAddr, len, 0);
-#endif
- if (bytesRead == -1) {
- operLen = 0;
- return LOB_DATA_READ_ERROR;
- } else {
+
operLen = bytesRead;
- }
-
- return LOB_OPER_OK;
-}
-
-*/
-Ex_Lob_Error ExLob::readDataToLocalFile(char *fileName, Int64 offset, Int64 &operLen)
-{
- Ex_Lob_Error err;
-
- ExLobDesc desc;
- err = getDesc(desc);
- if (err != LOB_OPER_OK)
- return err;
-
- if (offset > desc.getSize())
- {
- operLen = 0;
return LOB_OPER_OK;
}
-
- char *data = (char *)memalign(512, desc.getSize());
- if (data == NULL) {
- return LOB_SOURCE_DATA_ALLOC_ERROR;
+ else
+ {
+ //handle reading the multiple chunks like a cursor
+ err = readCursor(memAddr,size, getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen(), operLen);
+
+
+ if (err==LOB_OPER_OK)
+ closeCursor(getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen());
+ else
+ return err;
}
+ return LOB_OPER_OK;
+}
-#ifdef SQ_USE_HDFS
- // tbd
-#else
- if (pread(fdData_, data, desc.getSize(), desc.getOffset()) == -1) {
- free(data);
- return LOB_DATA_READ_ERROR;
- }
-#endif
+
- int openFlags = O_CREAT | O_RDWR ; // O_DIRECT needs mem alignment
- int filePerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+Ex_Lob_Error ExLob::readDataToLocalFile(char *fileName, Int64 offset, Int64 size, Int64 &writeOperLen, Int64 lobMaxChunkMemSize, Int32 fileflags)
+{
+ Ex_Lob_Error err;
+ Int64 operLen = 0;
+
+ Int64 srcLen = size;
+ Int64 srcOffset = offset;
+ Int64 tgtOffset = 0;
+ char *lobData = 0;
+ Int64 chunkSize = 0;
+ if (srcLen <=0)
+ return LOB_SOURCE_DATA_ALLOC_ERROR;
+ // open the targte file for writing
+ int filePerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+ int openFlags = O_RDWR ; // O_DIRECT needs mem alignment
+ if ((LobTgtFileFlags)fileflags == Lob_Append_Or_Error )
+ openFlags |= O_APPEND;
+ else
+ openFlags |= O_TRUNC;
int fdDestFile = open(fileName, openFlags, filePerms);
- if (fdDestFile == -1) {
- return LOB_DEST_FILE_OPEN_ERROR;
- }
-
- if (pwrite(fdDestFile, data, desc.getSize(), 0) == -1) {
- free(data);
- close(fdDestFile);
- return LOB_DATA_WRITE_ERROR;
- }
+
+ if (fdDestFile >0 )
+ {
+ if ((LobTgtFileFlags)fileflags == Lob_Error_Or_Create)
+ return LOB_TARGET_FILE_EXISTS_ERROR;
+ }
+ if (fdDestFile == -1)
+ {
+ if (((LobTgtFileFlags)fileflags == Lob_Append_Or_Error) ||
+ ((LobTgtFileFlags)fileflags == Lob_Truncate_Or_Error))
+ return LOB_TARGET_FILE_OPEN_ERROR;
+ else
+ {
+ openFlags = O_CREAT | O_RDWR ;
+ fdDestFile = open(fileName, openFlags, filePerms);
+ if (fdDestFile == -1)
+ return LOB_TARGET_FILE_OPEN_ERROR;
+ }
+ }
+ if ((srcLen < lobMaxChunkMemSize) && (getRequest()->getBlackBoxLen() != -1)) // simple single I/O case
+ {
+ lobData = (char *) (getLobGlobalHeap())->allocateMemory(srcLen);
- operLen = desc.getSize();
-
- free(data);
+ if (lobData == NULL)
+ {
+ return LOB_SOURCE_DATA_ALLOC_ERROR;
+ }
+ err = readDataToMem(lobData, srcOffset,srcLen,operLen);
+ if (err != LOB_OPER_OK)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return err;
+ }
+
+ writeOperLen += pwrite(fdDestFile, lobData, srcLen, tgtOffset) ;
+ if (writeOperLen <= 0)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_TARGET_FILE_WRITE_ERROR;
+ }
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ }
+ else // multiple chunks to read
+ {
+ err = openCursor(getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen());
+ if (err != LOB_OPER_OK)
+ return err;
+ while ( srcLen > 0)
+ {
+ chunkSize = MINOF(srcLen, lobMaxChunkMemSize);
+ lobData = (char *) (getLobGlobalHeap())->allocateMemory(chunkSize);
+
+ if (lobData == NULL)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_SOURCE_DATA_ALLOC_ERROR;
+ }
+ //handle reading the multiple chunks like a cursor
+ err = readCursor(lobData,chunkSize, getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen(), operLen);
+
+ if ((err != LOB_OPER_OK) || (operLen != chunkSize))
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return err;
+ }
+
+ writeOperLen += pwrite(fdDestFile, lobData, chunkSize, tgtOffset) ;
+ if (writeOperLen <= 0)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_TARGET_FILE_WRITE_ERROR;
+ }
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ srcLen -= chunkSize;
+ tgtOffset += chunkSize;
+ }
+ closeCursor(getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen());
+ }
close(fdDestFile);
-
return LOB_OPER_OK;
}
-Ex_Lob_Error ExLob::readDataToHdfsFile(char *tgtFileName, Int64 offset, Int64 &operLen)
-{
- Ex_Lob_Error err;
- ExLobDesc desc;
- err = getDesc(desc);
- if (err != LOB_OPER_OK)
- return err;
- if (desc.getSize() <=0 )
- {
- return LOB_SOURCE_FILE_READ_ERROR;
- }
- char *lobData = (char *) (getLobGlobalHeap())->allocateMemory(desc.getSize());
- if (lobData == NULL) {
- return LOB_SOURCE_DATA_ALLOC_ERROR;
- }
- err = readToMem(lobData, desc.getSize(),operLen);
- if (err != LOB_OPER_OK)
- return err;
- // open and write to the target file
- int openFlags = O_WRONLY|O_CREAT;
- hdfsFile fdTgtFile = hdfsOpenFile(fs_,tgtFileName, openFlags, 0,0,0);
- if (fdTgtFile == NULL) {
- return LOB_TARGET_FILE_OPEN_ERROR;
- }
- operLen = hdfsWrite(fs_,fdTgtFile,lobData, desc.getSize());
- if (operLen <= 0)
- return LOB_TARGET_FILE_WRITE_ERROR;
-
- if (hdfsFlush(fs_, fdTgtFile))
- return LOB_DATA_FLUSH_ERROR;
-
- hdfsCloseFile(fs_, fdTgtFile);
-
- getLobGlobalHeap()->deallocateMemory(lobData);
- fdTgtFile = NULL;
- /*
-#ifdef SQ_USE_HDFS
- // tbd
-#else
- if (pread(fdData_, data, desc.getSize(), desc.getOffset()) == -1) {
- free(data);
- return LOB_DATA_READ_ERROR;
+Ex_Lob_Error ExLob::readDataToHdfsFile(char *tgtFileName, Int64 offset, Int64 size, Int64 &writeOperLen, Int64 lobMaxChunkMemLen, Int32 fileflags)
+{
+ Ex_Lob_Error err;
+ Int64 operLen = 0;
+
+ Int64 srcLen = size;
+ Int64 srcOffset = offset;
+ Int64 tgtOffset = 0;
+ char *lobData = 0;
+ Int64 chunkSize = 0;
+ hdfsFile fdTgtFile;
+ // open and write to the target file
+ int openFlags = O_WRONLY;
+ if ((LobTgtFileFlags)fileflags == Lob_Append_Or_Error )
+ openFlags |= O_APPEND;
+
+ //hdfsFile fdTgtFile = hdfsOpenFile(fs_,tgtFileName, openFlags, 0,0,0);
+ if (hdfsExists(fs_,tgtFileName) == 0)
+ {
+ if ((LobTgtFileFlags)fileflags == Lob_Error_Or_Create)
+ return LOB_TARGET_FILE_EXISTS_ERROR;
+ else
+ {
+ openFlags = O_WRONLY ;
+ fdTgtFile = hdfsOpenFile(fs_, tgtFileName, openFlags, 0,0,0);
+ if (fdTgtFile == NULL)
+ return LOB_TARGET_FILE_OPEN_ERROR;
+ }
}
-#endif
+ else
+ {
+ if (((LobTgtFileFlags)fileflags == Lob_Append_Or_Error) ||
+ ((LobTgtFileFlags)fileflags == Lob_Truncate_Or_Error))
+ return LOB_TARGET_FILE_OPEN_ERROR;
+ else
+ {
+ openFlags = O_WRONLY ;
+ fdTgtFile = hdfsOpenFile(fs_, tgtFileName, openFlags, 0,0,0);
+ if (fdTgtFile == NULL)
+ return LOB_TARGET_FILE_OPEN_ERROR;
+ }
+ }
- int openFlags = O_CREAT | O_RDWR ; // O_DIRECT needs mem alignment
- int filePerms = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
+ if ((srcLen < lobMaxChunkMemLen) && (getRequest()->getBlackBoxLen() != -1)) // simple single I/O case
+ {
+ lobData = (char *) (getLobGlobalHeap())->allocateMemory(srcLen);
- int fdDestFile = open(fileName, openFlags, filePerms);
- if (fdDestFile == -1) {
- return LOB_DEST_FILE_OPEN_ERROR;
+ if (lobData == NULL)
+ {
+ return LOB_SOURCE_DATA_ALLOC_ERROR;
+ }
+ err = readDataToMem(lobData, srcOffset,srcLen,operLen);
+ if (err != LOB_OPER_OK)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return err;
+ }
+
+ writeOperLen += hdfsWrite(fs_,fdTgtFile,lobData, srcLen);
+ if (writeOperLen <= 0)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_TARGET_FILE_WRITE_ERROR;
+ }
+ if (hdfsFlush(fs_, fdTgtFile))
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_DATA_FLUSH_ERROR;
+ }
+ getLobGlobalHeap()->deallocateMemory(lobData);
}
+ else
+ {// multiple chunks to read
+ err = openCursor(getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen());
+ if (err != LOB_OPER_OK)
+ return err;
+ while ( srcLen > 0)
+ {
+ chunkSize = MINOF(srcLen, lobMaxChunkMemLen);
+ lobData = (char *) (getLobGlobalHeap())->allocateMemory(chunkSize);
+ if (lobData == NULL)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_SOURCE_DATA_ALLOC_ERROR;
+ }
+ //handle reading the multiple chunks like a cursor
+ err = readCursor(lobData,chunkSize, getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen(), operLen);
- if (pwrite(fdDestFile, data, desc.getSize(), 0) == -1) {
- free(data);
- close(fdDestFile);
- return LOB_DATA_WRITE_ERROR;
+ if ((err != LOB_OPER_OK) || (operLen != chunkSize))
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return err;
+ }
+ writeOperLen += hdfsWrite(fs_,fdTgtFile,lobData, chunkSize);
+ if (writeOperLen <= 0)
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_TARGET_FILE_WRITE_ERROR;
+ }
+ if (hdfsFlush(fs_, fdTgtFile))
+ {
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ return LOB_DATA_FLUSH_ERROR;
+ }
+ getLobGlobalHeap()->deallocateMemory(lobData);
+ srcLen -= chunkSize;
+
+ }
+ closeCursor(getRequest()->getHandleIn(),
+ getRequest()->getHandleInLen());
}
+ hdfsCloseFile(fs_, fdTgtFile);
++ fdTgtFile=NULL;
+ hdfsCloseFile(fs_,fdData_);
++ fdData_=NULL;
+
+ return LOB_OPER_OK;
+}
- operLen = desc.getSize();
- descNum = desc.getNextDescNum();
- free(data);
- close(fdDestFile);
- */
- return LOB_OPER_OK;
-}
-Ex_Lob_Error ExLob::readDataToExternalFile(char *tgtFileName, Int64 offset, Int64 &operLen)
+
+Ex_Lob_Error ExLob::readDataToExternalFile(char *tgtFileName, Int64 offset, Int64 size, Int64 &operLen,Int64 lobMaxChunkMemLen,Int32 fileflags)
{
+ //TBD
return LOB_OPER_OK;
}
Ex_Lob_Error ExLob::closeFile()
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/exp/ExpLOBinterface.cpp
----------------------------------------------------------------------
diff --cc core/sql/exp/ExpLOBinterface.cpp
index 7e35ff2,c196131..fafeabb
--- a/core/sql/exp/ExpLOBinterface.cpp
+++ b/core/sql/exp/ExpLOBinterface.cpp
@@@ -905,5 -886,5 +905,8 @@@ Lng32 ExpLOBinterfaceStats
char * getLobErrStr(Lng32 errEnum)
{
++ if (errEnum < LOB_MIN_ERROR_NUM || errEnum > LOB_MAX_ERROR_NUM)
++ return (char *)"Unknown LOB error";
++else
return (char*)lobErrorEnumStr[errEnum - (Lng32)LOB_MIN_ERROR_NUM];
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/optimizer/NATable.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/regress/executor/EXPECTED130
----------------------------------------------------------------------
diff --cc core/sql/regress/executor/EXPECTED130
index fb11508,cefc0ba..c238675
--- a/core/sql/regress/executor/EXPECTED130
+++ b/core/sql/regress/executor/EXPECTED130
@@@ -1,5 -1,5 +1,10 @@@
>>obey TEST130(setup);
-->>
++>>create schema trafodion.lob;
++
++--- SQL operation complete.
++>>set schema trafodion.lob;
++
++--- SQL operation complete.
>>create table t130lob1 (c1 blob);
--- SQL operation complete.
@@@ -48,9 -48,9 +53,9 @@@ C
C1 C2
----------- ----------------------------------------------------------------------------------------------------
- 1 LOBH00000200010101732322546296399519351062856921349159118212304792117262953017"TRAFODION"."SCH"
- 2 LOBH00000200010101732322546296399519351062856921789244118212304792121771527017"TRAFODION"."SCH"
- 3 LOBH00000200010101732322546296399519351062856922182495718212304792125745870017"TRAFODION"."SCH"
- 1 LOBH000002000100013579647185009197177606709209127596718212300980818700469017"TRAFODION"."SCH"
- 2 LOBH000002000100013579647185009197177606709209460413718212300980822060824017"TRAFODION"."SCH"
- 3 LOBH000002000100013579647185009197177606709209768095018212300980825169591017"TRAFODION"."SCH"
++ 1 LOBH00000200010827149924669513523119458079935212215897718212307713571773592017"TRAFODION"."LOB"
++ 2 LOBH00000200010827149924669513523119458079935212743965518212307713577325796017"TRAFODION"."LOB"
++ 3 LOBH00000200010827149924669513523119458079935213217894818212307713582066513017"TRAFODION"."LOB"
--- 3 row(s) selected.
>>
@@@ -187,14 -187,14 +192,14 @@@ C1 (EXPR
>>update t130lob2 set c2=stringtolob(' appended c2 to all rows',append);
--- 3 row(s) updated.
-->>select c1, lobtostring(c2,50) from t130lob2;
++>>select c1, lobtostring(c2,60) from t130lob2;
--C1 (EXPR)
------------- --------------------------------------------------
++C1 (EXPR)
++----------- ------------------------------------------------------------
-- 1 updated row21aappended row21a appended c2 to all r
-- 2 updated c2 in all rows appended c2 to all rows
-- 3 updated c2 in all rows appended c2 to all rows
++ 1 updated row21aappended row21a appended c2 to all rows
++ 2 updated c2 in all rows appended c2 to all rows
++ 3 updated c2 in all rows appended c2 to all rows
--- 3 row(s) selected.
>>
@@@ -220,5 -220,5 +225,389 @@@ C1 (EXPR
>>select * from t130lob2;
--- 0 row(s) selected.
++>>log;
++>>--setup
++>>sh echo "Test for file input and extract";
++>>create table tlob130txt1 (c1 int not null, c2 clob, primary key (c1));
++
++--- SQL operation complete.
++>>create table tlob130bin1 (c1 int not null, c2 blob, primary key (c1));
++
++--- SQL operation complete.
++>>sh cp $scriptsdir/executor/deep.jpg $rundir/executor/;
++>>sh cp $scriptsdir/executor/anoush.jpg $rundir/executor/;
++>>sh cp $scriptsdir/executor/lob_input_* $rundir/executor/;
++>>
++>>-- inserts
++>>-- first line
++>>insert into tlob130txt1 values (1, filetolob('lob_input_a1.txt'));
++
++--- 1 row(s) inserted.
++>>
++>>-- second line
++>>insert into tlob130txt1 values (2, filetolob('lob_input_b1.txt'));
++
++--- 1 row(s) inserted.
++>>
++>>-- third line
++>>insert into tlob130txt1 values (3, filetolob('lob_input_c1.txt'));
++
++--- 1 row(s) inserted.
++>>
++>>select lobtostring(c2, 40 ) from tlob130txt1;
++
++(EXPR)
++----------------------------------------
++
++Hey diddle diddle,
++
++The cat and the fiddle,
++
++The cow jumped over the moon.
++
++
++--- 3 row(s) selected.
++>>
++>>--updates
++>>
++>>--should update with full poem
++>>update tlob130txt1 set c2=filetolob('lob_input_d1.txt', append) where c1 = 3;
++
++--- 1 row(s) updated.
++>>
++>>select lobtostring(c2, 200 ) from tlob130txt1;
++
++(EXPR)
++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
++
++Hey diddle diddle,
++
++The cat and the fiddle,
++
++The cow jumped over the moon.
++The little dog laughed,
++To see such sport,
++
++And the dish ran away with the spoon.
++
++
++--- 3 row(s) selected.
++>>
++>>-- should see wrong text in the last few lines
++>>update tlob130txt1 set c2=filetolob('lob_input_e1.txt') where c1 =3 ;
++
++--- 1 row(s) updated.
++>>
++>>select lobtostring(c2, 200 ) from tlob130txt1;
++
++(EXPR)
++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
++
++Hey diddle diddle,
++
++The cat and the fiddle,
++
++The little dog cried,
++To see such sport,
++
++And the dish ran away with the fork !
++
++
++--- 3 row(s) selected.
++>>
++>>--delete
++>>
++>>-- go back to having just the first line.
++>>delete from tlob130txt1 where c1 =2;
++
++--- 1 row(s) deleted.
++>>delete from tlob130txt1 where c1 =3;
++
++--- 1 row(s) deleted.
++>>
++>>--test extract
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_txt1.txt');/g" >> t130_extract_command;
++>>
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200010827149924669516602019458079935241180341618212307713861636215017"TRAFODION"."LOB" ' , 'tlob130_txt1.txt');
++
++*** ERROR[8442] Unable to access ExpLOBInterfaceSelect interface. Call to LOB_TGT_FILE_EXISTS_ERROR returned error (561). Error detail 14.
++
++--- SQL operation failed with errors.
++>>
++>>--binary input/update
++>>
++>>insert into tlob130bin1 values (1 , filetolob('deep.jpg'));
++
++--- 1 row(s) inserted.
++>>--extract // should have a viewable picture file
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_deep.jpg');/g" >> t130_extract_command;
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200010827149924669516658419458079935246610468918212307713915677018017"TRAFODION"."LOB" ' , 'tlob130_deep.jpg');
++Success. Targetfile :tlob130_deep.jpg Length : 211849
++
++--- SQL operation complete.
++>>
++>>update tlob130bin1 set c2=filetolob('anoush.jpg') ;
++
++--- 1 row(s) updated.
++>>
++>>--extract into a different file // should have a different viewable picture.
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_anoush.jpg');/g" >> t130_extract_command;
++>>
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200010827149924669516658419458079935246610468918212307713915677018017"TRAFODION"."LOB" ' , 'tlob130_anoush.jpg');
++Success. Targetfile :tlob130_anoush.jpg Length : 431839
++
++--- SQL operation complete.
++>>
++>>
++>>
++>>
++>>-- Test for hdfs input
++>>--cleanup -- comment the following lines out if you want to debug this test and save intermediate files.
++>>obey TEST130(lob_hdfs_cleanup);
++>>log;
++>>create table tlob130txt2 (c1 int not null, c2 clob, primary key (c1));
++
++--- SQL operation complete.
++>>create table tlob130bin2 (c1 int not null, c2 blob, primary key (c1));
++
++--- SQL operation complete.
++>>
++>>sh swhadoop fs -copyFromLocal lob_input_a1.txt /mydata/lob_input_a1.txt;
++>>sh swhadoop fs -copyFromLocal lob_input_b1.txt /mydata/lob_input_b1.txt;
++>>sh swhadoop fs -copyFromLocal lob_input_c1.txt /mydata/lob_input_c1.txt;
++>>sh swhadoop fs -copyFromLocal lob_input_d1.txt /mydata/lob_input_d1.txt;
++>>sh swhadoop fs -copyFromLocal lob_input_e1.txt /mydata/lob_input_e1.txt;
++>>sh swhadoop fs -copyFromLocal deep.jpg /mydata/deep.jpg;
++>>sh swhadoop fs -copyFromLocal anoush.jpg /mydata/anoush.jpg;
++>>
++>>
++>>
++>>insert into tlob130txt2 values (1, filetolob('hdfs:///mydata/lob_input_a1.txt'));
++
++--- 1 row(s) inserted.
++>>
++>>-- second line
++>>insert into tlob130txt2 values (2, filetolob('hdfs:///mydata/lob_input_b1.txt'));
++
++--- 1 row(s) inserted.
++>>
++>>-- third line
++>>insert into tlob130txt2 values (3, filetolob('hdfs:///mydata/lob_input_c1.txt'));
++
++--- 1 row(s) inserted.
++>>select lobtostring(c2, 40 ) from tlob130txt2;
++
++(EXPR)
++----------------------------------------
++
++Hey diddle diddle,
++
++The cat and the fiddle,
++
++The cow jumped over the moon.
++
++
++--- 3 row(s) selected.
++>>
++>>--updates
++>>
++>>--should update with full poem
++>>update tlob130txt2 set c2=filetolob('hdfs:///mydata/lob_input_d1.txt', append) where c1 = 3;
++
++--- 1 row(s) updated.
++>>select lobtostring(c2, 200 ) from tlob130txt2;
++
++(EXPR)
++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
++
++Hey diddle diddle,
++
++The cat and the fiddle,
++
++The cow jumped over the moon.
++The little dog laughed,
++To see such sport,
++
++And the dish ran away with the spoon.
++
++
++--- 3 row(s) selected.
++>>
++>>-- should see wrong text in the last few lines
++>>update tlob130txt2 set c2=filetolob('hdfs:///mydata/lob_input_e1.txt') where c1 =3 ;
++
++--- 1 row(s) updated.
++>>select lobtostring(c2, 200 ) from tlob130txt2;
++
++(EXPR)
++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
++
++Hey diddle diddle,
++
++The cat and the fiddle,
++
++The little dog cried,
++To see such sport,
++
++And the dish ran away with the fork !
++
++
++--- 3 row(s) selected.
++>>
++>>--delete
++>>
++>>
++>>-- go back to having just the first line.
++>>delete from tlob130txt2 where c1 =2;
++
++--- 1 row(s) deleted.
++>>delete from tlob130txt2 where c1 =3;
++
++--- 1 row(s) deleted.
++>>-- test extract
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_txt2.txt');/g" >> t130_extract_command;
++>>
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200010827149924669517521119458079935252803179018212307713977881129017"TRAFODION"."LOB" ' , 'hdfs:///mydata/tlob130_txt2.txt');
++Success. Targetfile :hdfs:///mydata/tlob130_txt2.txt Length : 19
++
++--- SQL operation complete.
++>>
++>>--binary input/update
++>>
++>>insert into tlob130bin2 values (1 , filetolob('deep.jpg'));
++
++--- 1 row(s) inserted.
++>>--extract // should have a viewable picture file
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_deep.jpg');/g" >> t130_extract_command;
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200010827149924669517576419458079935258063413518212307714030565738017"TRAFODION"."LOB" ' , 'hdfs:///mydata/tlob130_deep.jpg');
++Success. Targetfile :hdfs:///mydata/tlob130_deep.jpg Length : 211849
++
++--- SQL operation complete.
++>>
++>>update tlob130bin2 set c2=filetolob('anoush.jpg') ;
++
++--- 1 row(s) updated.
++>>
++>>--extract into a different file // should have a different viewable picture.
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_anoush.jpg');/g" >> t130_extract_command;
++>>
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200010827149924669516658419458079935246610468918212307713915677018017"TRAFODION"."LOB" ' , 'hdfs:///mydata/tlob130_anoush.jpg');
++Success. Targetfile :hdfs:///mydata/tlob130_anoush.jpg Length : 431839
++
++--- SQL operation complete.
++>>
++>>
++>>
++>>
++>>------------------------------------------------------------------------------
++>>obey TEST130(lob_misc_cleanup);
++>>log;
++>>-- 2 clob columns
++>>create table tlob130txt3 (c1 int not null, c2 int, c3 clob, c4 clob, primary key (c1));
++
++--- SQL operation complete.
++>>insert into tlob130txt3 values (1, 1,filetolob('lob_input_a1.txt'), filetolob('lob_input_b1.txt'));
++
++--- 1 row(s) inserted.
++>>insert into tlob130txt3 values (2, 2,filetolob('lob_input_c1.txt'), filetolob('lob_input_d1.txt'));
++
++--- 1 row(s) inserted.
++>>select lobtostring(c3,100), lobtostring(c4,100)from tlob130txt3;
++
++(EXPR) (EXPR)
++---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
++
++Hey diddle diddle,
++ The cat and the fiddle,
++
++The cow jumped over the moon.
++ The little dog laughed,
++To see such sport,
++
++And the dish ran away with the spoon.
++
++
++--- 2 row(s) selected.
++>>
++>>-- 2 blob columns
++>>create table tlob130bin3 (c1 int not null, c2 int, c3 blob, c4 blob, primary key (c1));
++
++--- SQL operation complete.
++>>insert into tlob130bin3 values (1, 1, filetolob('deep.jpg'), filetolob('anoush.jpg'));
++
++--- 1 row(s) inserted.
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_deep2.jpg');/g" >> t130_extract_command;
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200020827149924669519031519458079935265221310118212307714102098056017"TRAFODION"."LOB" ' , 'tlob130_deep2.jpg');
++
++*** ERROR[8442] Unable to access ExpLOBInterfaceSelect interface. Call to LOB_TGT_FILE_EXISTS_ERROR returned error (561). Error detail 14.
++
++--- SQL operation failed with errors.
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_anoush2.jpg');/g" >> t130_extract_command;
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200030827149924669519031519458079935265685625418212307714106540895017"TRAFODION"."LOB" ' , 'hdfs:///mydata/tlob130_anoush2.jpg');
++Success. Targetfile :hdfs:///mydata/tlob130_anoush2.jpg Length : 431839
++
++--- SQL operation complete.
++>>
++>>-- combination blob and clob columns
++>>create table tlob130bt (c1 int not null, c2 int, c3 blob, c4 clob, primary key (c1));
++
++--- SQL operation complete.
++>>insert into tlob130bt values (1,1, filetolob('lob_input_a1.txt'), filetolob('anoush.jpg'));
++
++--- 1 row(s) inserted.
++>>
++>>select lobtostring(c3,40) from tlob130bt;
++
++(EXPR)
++----------------------------------------
++
++Hey diddle diddle,
++
++
++--- 1 row(s) selected.
++>>
++>>log;
++>>sh rm t130_extract_command;
++>>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_anoush3.jpg',truncate);/g" >> t130_extract_command;
++>>obey t130_extract_command;
++>>extract lobtofile(LOB 'LOBH00000200030827149924669519329619458079935268825577218212307714138167794017"TRAFODION"."LOB" ' , 'tlob130_anoush3.jpg',truncate);
++Success. Targetfile :tlob130_anoush3.jpg Length : 431839
++
++--- SQL operation complete.
>>
++>>obey TEST130(lob_general_cleanup);
>>log;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/regress/executor/TEST130
----------------------------------------------------------------------
diff --cc core/sql/regress/executor/TEST130
index 53f5bdd,e691ead..6fdddd8
--- a/core/sql/regress/executor/TEST130
+++ b/core/sql/regress/executor/TEST130
@@@ -39,9 -39,9 +39,9 @@@ obey TEST130(clnup)
log LOG130 clear;
obey TEST130(setup);
--obey TEST130(dml);
--obey TEST130(clnup);
--exit;
++--obey TEST130(dml);
++--obey TEST130(clnup);
++--exit;
?section clnup
@@@ -52,7 -52,7 +52,8 @@@ drop table t130lob4 cascade
?section setup
--
++create schema trafodion.lob;
++set schema trafodion.lob;
create table t130lob1 (c1 blob);
create table t130lob2 (c1 int not null, c2 blob , primary key (c1));
create table t130lob3 (c1 int not null,
@@@ -117,7 -117,7 +118,7 @@@ select c1, lobtostring(c2,100) from t13
update t130lob2 set c2=stringtolob(' appended c2 to all rows',append);
--select c1, lobtostring(c2,50) from t130lob2;
++select c1, lobtostring(c2,60) from t130lob2;
obey TEST130(dml_delete);
@@@ -128,12 -128,12 +129,300 @@@ select c1, lobtostring(c2,30), lobtostr
delete from t130lob2 ;
select * from t130lob2;
--
log;
obey TEST130(clnup);
++sh echo "Test for file input and extract";
++-- Test for local input
++
++--cleanup -- comment the following lines out if you want to debug this test and save intermediate files.
++obey TEST130(lob_local_cleanup);
++?section lob_local_cleanup
++log;
++drop table tlob130txt1;
++drop table tlob130bin1;
++sh rm TMP130;
++sh rm tlob130txt1;
++sh rm tlob130_deep.jpg;
++sh rm tlob130_anoush.jpg;
++
++
++obey TEST130(lob_local_file);
++?section lob_local_file
++log LOG130;
++--setup
++sh echo "Test for file input and extract";
++create table tlob130txt1 (c1 int not null, c2 clob, primary key (c1));
++create table tlob130bin1 (c1 int not null, c2 blob, primary key (c1));
++sh cp $scriptsdir/executor/deep.jpg $rundir/executor/;
++sh cp $scriptsdir/executor/anoush.jpg $rundir/executor/;
++sh cp $scriptsdir/executor/lob_input_* $rundir/executor/;
++
++-- inserts
++-- first line
++insert into tlob130txt1 values (1, filetolob('lob_input_a1.txt'));
++
++-- second line
++insert into tlob130txt1 values (2, filetolob('lob_input_b1.txt'));
++
++-- third line
++insert into tlob130txt1 values (3, filetolob('lob_input_c1.txt'));
++
++select lobtostring(c2, 40 ) from tlob130txt1;
++
++--updates
++
++--should update with full poem
++update tlob130txt1 set c2=filetolob('lob_input_d1.txt', append) where c1 = 3;
++
++select lobtostring(c2, 200 ) from tlob130txt1;
++
++-- should see wrong text in the last few lines
++update tlob130txt1 set c2=filetolob('lob_input_e1.txt') where c1 =3 ;
++
++select lobtostring(c2, 200 ) from tlob130txt1;
++
++--delete
++
++-- go back to having just the first line.
++delete from tlob130txt1 where c1 =2;
++delete from tlob130txt1 where c1 =3;
++
++--test extract
++
++log;
++log TMP130 clear;
++select c2 from tlob130txt1;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_txt1.txt');/g" >> t130_extract_command;
++
++obey t130_extract_command;
++
++--binary input/update
++
++insert into tlob130bin1 values (1 , filetolob('deep.jpg'));
++--extract // should have a viewable picture file
++
++log;
++log TMP130 clear;
++select c2 from tlob130bin1;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_deep.jpg');/g" >> t130_extract_command;
++obey t130_extract_command;
++
++update tlob130bin1 set c2=filetolob('anoush.jpg') ;
++
++--extract into a different file // should have a different viewable picture.
++
++log;
++log TMP130 clear ;
++select c2 from tlob130bin1;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_anoush.jpg');/g" >> t130_extract_command;
++
++obey t130_extract_command;
++
++
++
++
++-- Test for hdfs input
++--cleanup -- comment the following lines out if you want to debug this test and save intermediate files.
++obey TEST130(lob_hdfs_cleanup);
++?section lob_hdfs_cleanup
++log;
++drop table tlob130txt2;
++drop table tlob130bin2;
++sh rm TMP130;
++sh rm tlob130txt2;
++sh swhadoop fs -rm /mydata/tlob130_deep.jpg;
++sh swhadoop fs -rm /mydata/tlob130_anoush.jpg;
++
++
++obey TEST130(lob_hdfs_file);
++?section lob_hdfs_file
++log LOG130;
++create table tlob130txt2 (c1 int not null, c2 clob, primary key (c1));
++create table tlob130bin2 (c1 int not null, c2 blob, primary key (c1));
++
++sh swhadoop fs -copyFromLocal lob_input_a1.txt /mydata/lob_input_a1.txt;
++sh swhadoop fs -copyFromLocal lob_input_b1.txt /mydata/lob_input_b1.txt;
++sh swhadoop fs -copyFromLocal lob_input_c1.txt /mydata/lob_input_c1.txt;
++sh swhadoop fs -copyFromLocal lob_input_d1.txt /mydata/lob_input_d1.txt;
++sh swhadoop fs -copyFromLocal lob_input_e1.txt /mydata/lob_input_e1.txt;
++sh swhadoop fs -copyFromLocal deep.jpg /mydata/deep.jpg;
++sh swhadoop fs -copyFromLocal anoush.jpg /mydata/anoush.jpg;
++
++
++
++insert into tlob130txt2 values (1, filetolob('hdfs:///mydata/lob_input_a1.txt'));
++
++-- second line
++insert into tlob130txt2 values (2, filetolob('hdfs:///mydata/lob_input_b1.txt'));
++
++-- third line
++insert into tlob130txt2 values (3, filetolob('hdfs:///mydata/lob_input_c1.txt'));
++select lobtostring(c2, 40 ) from tlob130txt2;
++
++--updates
++
++--should update with full poem
++update tlob130txt2 set c2=filetolob('hdfs:///mydata/lob_input_d1.txt', append) where c1 = 3;
++select lobtostring(c2, 200 ) from tlob130txt2;
++
++-- should see wrong text in the last few lines
++update tlob130txt2 set c2=filetolob('hdfs:///mydata/lob_input_e1.txt') where c1 =3 ;
++select lobtostring(c2, 200 ) from tlob130txt2;
++
++--delete
++
++
++-- go back to having just the first line.
++delete from tlob130txt2 where c1 =2;
++delete from tlob130txt2 where c1 =3;
++-- test extract
++
++log;
++log TMP130 clear;
++select c2 from tlob130txt2;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_txt2.txt');/g" >> t130_extract_command;
++
++obey t130_extract_command;
++
++--binary input/update
++
++insert into tlob130bin2 values (1 , filetolob('deep.jpg'));
++--extract // should have a viewable picture file
++
++log;
++log TMP130 clear ;
++select c2 from tlob130bin2;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_deep.jpg');/g" >> t130_extract_command;
++obey t130_extract_command;
++
++update tlob130bin2 set c2=filetolob('anoush.jpg') ;
++
++--extract into a different file // should have a different viewable picture.
++
++log;
++log TMP130 clear;
++select c2 from tlob130bin1;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_anoush.jpg');/g" >> t130_extract_command;
++
++obey t130_extract_command;
++
++
++
++
++------------------------------------------------------------------------------
++obey TEST130(lob_misc_cleanup);
++?section lob_misc_cleanup
++log;
++drop table tlob130txt3;
++drop table tlob130bin3;
++drop table tlob130bt;
++
++
++obey TEST130(lob_miscfile_test);
++
++?section lob_miscfile_test
++log LOG130;
++-- 2 clob columns
++create table tlob130txt3 (c1 int not null, c2 int, c3 clob, c4 clob, primary key (c1));
++insert into tlob130txt3 values (1, 1,filetolob('lob_input_a1.txt'), filetolob('lob_input_b1.txt'));
++insert into tlob130txt3 values (2, 2,filetolob('lob_input_c1.txt'), filetolob('lob_input_d1.txt'));
++select lobtostring(c3,100), lobtostring(c4,100)from tlob130txt3;
++
++-- 2 blob columns
++create table tlob130bin3 (c1 int not null, c2 int, c3 blob, c4 blob, primary key (c1));
++insert into tlob130bin3 values (1, 1, filetolob('deep.jpg'), filetolob('anoush.jpg'));
++
++log;
++log TMP130 clear;
++select c3 from tlob130bin3;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_deep2.jpg');/g" >> t130_extract_command;
++obey t130_extract_command;
++
++log;
++log TMP130 clear;
++select c4 from tlob130bin3;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/mydata\/tlob130_anoush2.jpg');/g" >> t130_extract_command;
++obey t130_extract_command;
++
++-- combination blob and clob columns
++create table tlob130bt (c1 int not null, c2 int, c3 blob, c4 clob, primary key (c1));
++insert into tlob130bt values (1,1, filetolob('lob_input_a1.txt'), filetolob('anoush.jpg'));
++
++select lobtostring(c3,40) from tlob130bt;
++
++log;
++log TMP130 clear;
++select c4 from tlob130bt;
++log;
++
++log LOG130;
++sh rm t130_extract_command;
++sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_anoush3.jpg',truncate);/g" >> t130_extract_command;
++obey t130_extract_command;
++
++obey TEST130(lob_general_cleanup);
++-- cleanup
++?section lob_general_cleanup
++log;
++sh rm t130_*;
++sh swhadoop fs -rm /mydata/tlob130_*
++sh rm lobinput_*;
++sh rm deep.jpg;
++sh rm anoush.jpg;
++drop table tlob130txt1;
++drop table tlob130bin1;
++sh rm TMP130;
++sh rm tlob130txt1;
++sh rm tlob130_deep.jpg;
++sh rm tlob130_anoush.jpg;
++drop table tlob130txt3;
++drop table tlob130bin3;
++drop table tlob130bt;
++drop table tlob130txt2;
++drop table tlob130bin2;
++sh rm TMP130;
++sh rm tlob130txt2;
++
++drop schema trafodion.lob;
++
++exit;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index f64b310,2e00b09..dbd3c48
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@@ -1840,86 -2102,85 +2102,87 @@@ short CmpSeabaseDDL::createSeabaseTable
}
}
- HbaseStr hbaseTable;
- hbaseTable.val = (char*)extNameForHbase.data();
- hbaseTable.len = extNameForHbase.length();
- if (createHbaseTable(ehi, &hbaseTable, trafColFamVec,
- &hbaseCreateOptions,
- numSplits, keyLength,
- encodedKeysBuffer) == -1)
- {
- deallocEHI(ehi);
+ HbaseStr hbaseTable;
+ hbaseTable.val = (char*)extNameForHbase.data();
+ hbaseTable.len = extNameForHbase.length();
+ if (createHbaseTable(ehi, &hbaseTable, trafColFamVec,
+ &hbaseCreateOptions,
+ numSplits, keyLength,
+ encodedKeysBuffer) == -1)
+ {
+ deallocEHI(ehi);
- processReturn();
+ processReturn();
- return -2;
- }
+ return -2;
+ }
- // if this table has lob columns, create the lob files
- short *lobNumList = new (STMTHEAP) short[numCols];
- short *lobTypList = new (STMTHEAP) short[numCols];
- char **lobLocList = new (STMTHEAP) char*[numCols];
- Lng32 j = 0;
- for (Int32 i = 0; i < colArray.entries(); i++)
- {
- ElemDDLColDef *column = colArray[i];
-
- Lng32 datatype = column->getColumnDataType()->getFSDatatype();
- if ((datatype == REC_BLOB) ||
- (datatype == REC_CLOB))
- {
- lobNumList[j] = i; //column->getColumnNumber();
- lobTypList[j] =
- (short)(column->getLobStorage() == Lob_Invalid_Storage
- ? Lob_HDFS_File : column->getLobStorage());
+ // if this table has lob columns, create the lob files
+ short *lobNumList = new (STMTHEAP) short[numCols];
+ short *lobTypList = new (STMTHEAP) short[numCols];
+ char **lobLocList = new (STMTHEAP) char*[numCols];
+ Lng32 j = 0;
+ for (Int32 i = 0; i < colArray.entries(); i++)
+ {
+ ElemDDLColDef *column = colArray[i];
+
+ Lng32 datatype = column->getColumnDataType()->getFSDatatype();
+ if ((datatype == REC_BLOB) ||
+ (datatype == REC_CLOB))
+ {
+ lobNumList[j] = i; //column->getColumnNumber();
+ lobTypList[j] =
+ (short)(column->getLobStorage() == Lob_Invalid_Storage
+ ? Lob_HDFS_File : column->getLobStorage());
- // lobTypList[j] = (short)
- // CmpCommon::getDefaultNumeric(LOB_STORAGE_TYPE);
- char * loc = new (STMTHEAP) char[1024];
+ // lobTypList[j] = (short)
+ // CmpCommon::getDefaultNumeric(LOB_STORAGE_TYPE);
+ char * loc = new (STMTHEAP) char[1024];
- const char* f = ActiveSchemaDB()->getDefaults().
- getValue(LOB_STORAGE_FILE_DIR);
+ const char* f = ActiveSchemaDB()->getDefaults().
+ getValue(LOB_STORAGE_FILE_DIR);
- strcpy(loc, f);
+ strcpy(loc, f);
- lobLocList[j] = loc;
- j++;
- }
+ lobLocList[j] = loc;
+ j++;
+ }
}
- Int64 lobMaxSize = CmpCommon::getDefaultNumeric(LOB_MAX_SIZE)*1024*1024;
- if (j > 0)
- {
- Int64 objUID = getObjectUID(&cliInterface,
- catalogNamePart.data(), schemaNamePart.data(),
- objectNamePart.data(),
- COM_BASE_TABLE_OBJECT_LIT);
-
- ComString newSchName = "\"";
- newSchName += catalogNamePart;
- newSchName.append("\".\"");
- newSchName.append(schemaNamePart);
- newSchName += "\"";
- Lng32 rc = SQL_EXEC_LOBddlInterface((char*)newSchName.data(),
- newSchName.length(),
-
++
++ Int64 lobMaxSize = CmpCommon::getDefaultNumeric(LOB_MAX_SIZE)*1024*1024;
+ if (j > 0)
+ {
+ Int64 objUID = getObjectUID(&cliInterface,
+ catalogNamePart.data(), schemaNamePart.data(),
+ objectNamePart.data(),
+ COM_BASE_TABLE_OBJECT_LIT);
+
+ ComString newSchName = "\"";
+ newSchName += catalogNamePart;
+ newSchName.append("\".\"");
+ newSchName.append(schemaNamePart);
+ newSchName += "\"";
+ Lng32 rc = SQL_EXEC_LOBddlInterface((char*)newSchName.data(),
+ newSchName.length(),
objUID,
j,
LOB_CLI_CREATE,
lobNumList,
lobTypList,
- lobLocList);
+ lobLocList,
+ lobMaxSize);
- if (rc < 0)
- {
- //sss TBD need to retrive the cli diags here.
- *CmpCommon::diags() << DgSqlCode(-CAT_CREATE_OBJECT_ERROR)
- << DgTableName(extTableName);
- deallocEHI(ehi);
-
- processReturn();
++
+ if (rc < 0)
+ {
+ //sss TBD need to retrive the cli diags here.
+ *CmpCommon::diags() << DgSqlCode(-CAT_CREATE_OBJECT_ERROR)
+ << DgTableName(extTableName);
- deallocEHI(ehi);
-
++ deallocEHI(ehi);
+ processReturn();
- return -2;
- }
- }
+ return -2;
+ }
+ }
// if not a compound create, update valid def to true.
if (NOT ((createTableNode->getAddConstraintUniqueArray().entries() > 0) ||
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85f1b7c2/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------