You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2017/05/02 17:24:11 UTC

[1/7] incubator-trafodion git commit: Support for insert-select for tables containing LOB columns.

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master b791f8831 -> d0c4d7306


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/regress/executor/TEST130
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/TEST130 b/core/sql/regress/executor/TEST130
index 0a64476..b98f428 100755
--- a/core/sql/regress/executor/TEST130
+++ b/core/sql/regress/executor/TEST130
@@ -105,10 +105,34 @@ insert into t130var values (1,'var char 1'),(2,'var char 22222222222222222222222
 insert into t130lob2(c1,c2) select c1,c2 from t130var;
 select lobtostring(c2,100) from t130lob2;
 
+--insert select from a source lob column to a target varchar column.
+delete from t130var;
+insert into t130var select c1, lobtostring(c2,100) from t130lob2;
+delete from t130var;
+----negative case
+insert into t130var select c1,c2 from t130lob2;
+delete from t130var;
+delete from t130lob2;
+
 --test insert select from a source hive varchar column to lob
 delete from t130lob2;
 insert into t130lob2 select [first 10] d_date_sk,d_date_id from hive.hive.date_dim;
-select lobtostring(c2,40) from t130lob2;
+select lobtostring(c2,40) from t130lob2 order by c1;
+delete from t130lob2;
+
+
+--insert select from a source lob column to a target lob column
+delete from t130lob3;
+insert into t130lob2 values(1,stringtolob('inserted row11'));
+insert into t130lob2 values(2,stringtolob('inserted row12'));
+insert into t130lob2 values(3,stringtolob('inserted row13'));
+insert into t130lob3 select c1,c2,c2 from t130lob2;
+select c1, lobtostring(c2,100),lobtostring(c3,100) from t130lob3;
+delete from t130lob3;
+delete from t130lob2;
+
+
+
 
 --test values clause
 values((select * from t130lob1));
@@ -524,6 +548,8 @@ select * from table(lob stats(tlob130gt));
 ?section lob_external
 --test external lobs
 create table tlob130ext (c1 int not null, c2 blob, c3 clob, c4 blob storage 'external', primary key (c1));
+create table tlob130ext2 (c1 int not null, c2 blob, c3 clob, c4 blob storage 'external', primary key (c1));
+create table tlob130_not_external (c1 int not null , c2 blob, c3 blob, c4 blob, primary key (c1));
 insert into tlob130ext values(1, stringtolob('first lob'), filetolob('hdfs:///lobs/lob_input_a1.txt'),externaltolob('hdfs:///lobs/lob_input_a1.txt'));
 insert into tlob130ext values(2, stringtolob('second lob'), filetolob('hdfs:///lobs/lob_input_b1.txt'),externaltolob('hdfs:///lobs/lob_input_b1.txt'));
 insert into tlob130ext values(3, stringtolob('third lob'), filetolob('hdfs:///lobs/lob_input_c1.txt'),externaltolob('hdfs:///lobs/lob_input_c1.txt'));
@@ -558,6 +584,13 @@ select * from table(lob stats(tlob130ext));
 sh clitestdriver 2 < TEST130_argfile2 2>&1 | tee -a LOG130;
 sh cat lobc4ext.txt |tee -a LOG130;
 
+--insert select from a source external lob column to a target external lob column
+select lobtostring(c2,50),lobtostring(c3,50),lobtostring(c3,50) from tlob130ext;
+insert into tlob130ext2 select * from tlob130ext;
+select lobtostring(c2,50),lobtostring(c3,50),lobtostring(c3,50) from tlob130ext2;
+----negative test
+insert into tlob130_not_external select * from tlob130ext; 
+
 ?section update_lob_handle
 -- test lob update via "update lob" command
 log;
@@ -637,6 +670,7 @@ drop table tlob130bt;
 drop table tlob130txt2;
 drop table tlob130bin2; 
 drop table tlob130ext;
+drop table tlob130ext2;
 sh rm TMP130;
 sh rm tlob130txt2;
 sh rm lobc2out.jpg;
@@ -645,6 +679,7 @@ sh rm TEST130_argfile*;
 drop table tlob130gc;
 drop table tlob130gt;
 drop table tlob130t5;
+drop table tlob130_not_external;
 drop external table if exists date_dim for hive.hive.date_dim;
 drop schema trafodion.lob130 cascade;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 6c7e75c..19fe1ac 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -2093,7 +2093,7 @@ SDDkwd__(ISO_MAPPING,           (char *)SQLCHARSETSTRING_ISO88591),
   DD_____(LOB_STORAGE_FILE_DIR,                 "/lobs"), 
 
   // storage types defined in exp/ExpLOBenum.h. 
-  // Default is hdfs_file (value = 1)
+  // Default is hdfs_file (value = 2)
   DDint__(LOB_STORAGE_TYPE,                     "2"),
 
   //New default size for buffer size for local node

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/licenses/lic-pyinstall-src
----------------------------------------------------------------------
diff --git a/licenses/lic-pyinstall-src b/licenses/lic-pyinstall-src
index f0f74c2..0e2b129 100644
--- a/licenses/lic-pyinstall-src
+++ b/licenses/lic-pyinstall-src
@@ -5,8 +5,8 @@ MIT-like licenses:
 +++++++++++++++++++++++++++++
 
 BSD-3 clause for files in:
-    installer/python-installer/prettytable.py
-    installer/python-installer/scripts/httplib2/socks.py
+    install/python-installer/prettytable.py
+    install/python-installer/scripts/httplib2/socks.py
 
 
 Redistribution and use in source and binary forms, with or without


[5/7] incubator-trafodion git commit: Merge remote branch 'origin/master' into lob_inssel_work

Posted by sa...@apache.org.
Merge remote branch 'origin/master' into lob_inssel_work


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

Branch: refs/heads/master
Commit: fe262aa2ec613c53b26f55ef37afa82349cf30be
Parents: 7e10b5a b36003c
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Fri Apr 28 15:42:32 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Fri Apr 28 15:42:32 2017 +0000

----------------------------------------------------------------------
 core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp    | 16 +++++-
 core/sqf/conf/log4cxx.trafodion.lob.config      | 49 -----------------
 core/sqf/conf/log4cxx.trafodion.sql.config      | 51 ++++++++++++++++++
 core/sqf/conf/log4cxx.trafodion.udr.config      | 50 -----------------
 core/sqf/conf/log4j.hdfs.config                 | 56 --------------------
 core/sqf/conf/log4j.sql.config                  | 51 ++++++++++++++++++
 core/sqf/tools/sqtools.sh                       |  2 +-
 core/sql/bin/SqlciMain.cpp                      |  5 +-
 core/sql/bin/arkcmp.cpp                         | 12 +----
 core/sql/bin/ex_esp_main.cpp                    |  9 +---
 core/sql/cli/CliExtern.cpp                      |  2 +-
 core/sql/executor/HBaseClient_JNI.cpp           |  3 +-
 core/sql/exp/ExpLOBaccess.cpp                   |  2 +-
 core/sql/exp/ExpLOBprocess.cpp                  |  8 +--
 core/sql/qmscommon/QRLogger.cpp                 | 53 +++++++++---------
 core/sql/qmscommon/QRLogger.h                   |  2 +
 core/sql/sqludr/SqlUdrPredefLogReader.cpp       |  1 +
 .../java/org/trafodion/sql/HBaseClient.java     | 30 +++++++----
 .../main/java/org/trafodion/sql/HiveClient.java |  7 ++-
 core/sql/udrserv/udrserv.cpp                    |  8 +--
 20 files changed, 184 insertions(+), 233 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/fe262aa2/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------


[7/7] incubator-trafodion git commit: Merge remote branch 'origin/pr/1072/head' into merge_1072

Posted by sa...@apache.org.
Merge remote branch 'origin/pr/1072/head' into merge_1072


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

Branch: refs/heads/master
Commit: d0c4d7306d9b992773381e7308d58d79aefaa603
Parents: b791f88 53e103c
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Tue May 2 17:23:38 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Tue May 2 17:23:38 2017 +0000

----------------------------------------------------------------------
 core/sql/bin/clitest.cpp              |   2 +-
 core/sql/clitest/blobtest.cpp         |   4 +-
 core/sql/common/ComSmallDefs.h        |   1 +
 core/sql/executor/ExExeUtilLoad.cpp   |   2 +-
 core/sql/exp/ExpLOB.cpp               | 103 +++----
 core/sql/exp/ExpLOB.h                 |  21 +-
 core/sql/exp/ExpLOBaccess.cpp         | 213 +++++++++++--
 core/sql/exp/ExpLOBaccess.h           |  22 +-
 core/sql/exp/ExpLOBenums.h            |  17 +-
 core/sql/exp/ExpLOBinterface.cpp      |  75 +++--
 core/sql/exp/ExpLOBinterface.h        |  34 ++-
 core/sql/generator/GenItemFunc.cpp    |   7 +-
 core/sql/generator/GenPreCode.cpp     |  52 ++--
 core/sql/optimizer/ItemFunc.h         |   2 +-
 core/sql/regress/executor/EXPECTED130 | 469 ++++++++++++-----------------
 core/sql/regress/executor/TEST130     |  37 ++-
 core/sql/sqlcomp/nadefaults.cpp       |   2 +-
 licenses/lic-pyinstall-src            |   4 +-
 18 files changed, 609 insertions(+), 458 deletions(-)
----------------------------------------------------------------------



[4/7] incubator-trafodion git commit: Merge remote branch 'origin/master'

Posted by sa...@apache.org.
Merge remote branch 'origin/master'


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

Branch: refs/heads/master
Commit: 7e10b5a65e9dbafd469778108f1645374d2b1d54
Parents: b8cfdc8 b5eb1cf
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Tue Apr 25 21:14:47 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Tue Apr 25 21:14:47 2017 +0000

----------------------------------------------------------------------
 core/conn/jdbcT4/.gitignore                     |   2 +
 core/conn/jdbcT4/Makefile                       |   3 +-
 core/conn/jdbcT4/pom.xml                        |  17 +-
 core/conn/trafci/installer_pom.xml              |   2 +-
 core/conn/trafci/pom.xml                        |   2 +-
 .../trafci/src/main/resources/install_jar.xml   |   2 +-
 core/rest/pom.xml                               |   2 +-
 core/sql/bin/SqlciErrors.txt                    |   2 +-
 core/sql/common/OperTypeEnum.h                  |   1 +
 core/sql/executor/ExHdfsScan.cpp                |   2 +-
 core/sql/exp/exp_clause.cpp                     |   7 +
 core/sql/exp/exp_clause.h                       |   3 +-
 core/sql/exp/exp_function.cpp                   |  80 ++++++++
 core/sql/exp/exp_function.h                     |  29 +++
 core/sql/generator/GenFastTransport.cpp         |   5 +-
 core/sql/generator/GenItemFunc.cpp              |   8 +
 core/sql/generator/GenRelScan.cpp               |  10 +-
 core/sql/optimizer/BindItemExpr.cpp             |  14 +-
 core/sql/optimizer/BindRelExpr.cpp              |  19 +-
 core/sql/optimizer/EncodedKeyValue.cpp          |   8 +
 core/sql/optimizer/ItemExpr.cpp                 |   6 +-
 core/sql/optimizer/SynthType.cpp                |  22 +++
 core/sql/parser/ParKeyWords.cpp                 |   1 +
 core/sql/parser/sqlparser.y                     |  10 +-
 core/sql/regress/charsets/EXPECTED315           | 188 +++++++++++++++++++
 core/sql/regress/charsets/TEST315               |  34 ++++
 core/sql/regress/executor/EXPECTED022.SB        |  24 ++-
 core/sql/regress/executor/TEST022               |   3 +
 core/sql/regress/hive/TEST007                   |   3 +
 core/sql/regress/seabase/EXPECTED025            |  49 ++++-
 core/sql/regress/seabase/EXPECTED031            |  74 ++++++--
 core/sql/regress/seabase/TEST025                |  10 +
 core/sql/regress/seabase/TEST031                |  11 ++
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |  43 ++++-
 core/sql/ustat/hs_la.cpp                        |   1 -
 dcs/pom.xml                                     |   2 +-
 36 files changed, 659 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7e10b5a6/core/sql/generator/GenItemFunc.cpp
----------------------------------------------------------------------


[2/7] incubator-trafodion git commit: Support for insert-select for tables containing LOB columns.

Posted by sa...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/regress/executor/EXPECTED130
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED130 b/core/sql/regress/executor/EXPECTED130
index 8481fe4..0542d39 100644
--- a/core/sql/regress/executor/EXPECTED130
+++ b/core/sql/regress/executor/EXPECTED130
@@ -63,9 +63,9 @@ C1
 C1           C2
 -----------  ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ----------------------------------------
 
-          1  LOBH0000000200010238590751241267070319238590751254203356618212357742378141700020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                         
-          2  LOBH0000000200010238590751241267070319238590751255113052818212357742389924709020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                         
-          3  LOBH0000000200010238590751241267070319238590751256002486018212357742398569388020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                         
+          1  LOBH000000020001001830865086431665681818308650874102010718212359906316509152020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                         
+          2  LOBH000000020001001830865086431665681818308650874653085818212359906323581515020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                         
+          3  LOBH000000020001001830865086431665681818308650875141948918212359906328520376020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
                                         
 
 --- 3 row(s) selected.
 >>
@@ -178,14 +178,38 @@ var char 33333333333333333333333333333333333333333333333333333
 
 --- 3 row(s) selected.
 >>
->>--test insert select from a source hive varchar column to lob
+>>--insert select from a source lob column to a target varchar column.
+>>delete from t130var;
+
+--- 3 row(s) deleted.
+>>insert into t130var select c1, lobtostring(c2,100) from t130lob2;
+
+--- 3 row(s) inserted.
+>>delete from t130var;
+
+--- 3 row(s) deleted.
+>>----negative case
+>>insert into t130var select c1,c2 from t130lob2;
+
+*** ERROR[4035] Type LOB cannot be cast to type VARCHAR(100).
+
+*** ERROR[8822] The statement was not prepared.
+
+>>delete from t130var;
+
+--- 0 row(s) deleted.
 >>delete from t130lob2;
 
 --- 3 row(s) deleted.
+>>
+>>--test insert select from a source hive varchar column to lob
+>>delete from t130lob2;
+
+--- 0 row(s) deleted.
 >>insert into t130lob2 select [first 10] d_date_sk,d_date_id from hive.hive.date_dim;
 
 --- 10 row(s) inserted.
->>select lobtostring(c2,40) from t130lob2;
+>>select lobtostring(c2,40) from t130lob2 order by c1;
 
 (EXPR)                                  
 ----------------------------------------
@@ -202,6 +226,46 @@ AAAAAAAAGLJNECAA
 AAAAAAAAHLJNECAA                        
 
 --- 10 row(s) selected.
+>>delete from t130lob2;
+
+--- 10 row(s) deleted.
+>>
+>>
+>>--insert select from a source lob column to a target lob column
+>>delete from t130lob3;
+
+--- 0 row(s) deleted.
+>>insert into t130lob2 values(1,stringtolob('inserted row11'));
+
+--- 1 row(s) inserted.
+>>insert into t130lob2 values(2,stringtolob('inserted row12'));
+
+--- 1 row(s) inserted.
+>>insert into t130lob2 values(3,stringtolob('inserted row13'));
+
+--- 1 row(s) inserted.
+>>insert into t130lob3 select c1,c2,c2 from t130lob2;
+
+--- 3 row(s) inserted.
+>>select c1, lobtostring(c2,100),lobtostring(c3,100) from t130lob3;
+
+C1           (EXPR)                                                                                                (EXPR)
+-----------  ----------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------
+
+          1  inserted row11                                                                                        inserted row11                                                                                      
+          2  inserted row12                                                                                        inserted row12                                                                                      
+          3  inserted row13                                                                                        inserted row13                                                                                      
+
+--- 3 row(s) selected.
+>>delete from t130lob3;
+
+--- 3 row(s) deleted.
+>>delete from t130lob2;
+
+--- 3 row(s) deleted.
+>>
+>>
+>>
 >>
 >>--test values clause
 >>values((select * from t130lob1));
@@ -216,7 +280,7 @@ C1
 >>--test empty_blob(), empty_clob()
 >>delete from t130lob2;
 
---- 10 row(s) deleted.
+--- 0 row(s) deleted.
 >>insert into t130lob2 values (1, empty_blob());
 
 --- 1 row(s) inserted.
@@ -590,7 +654,7 @@ And the dish ran away with the fork !
 >>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 'LOBH0000000200010238590751241275912619238590751341141492618212357743249653246020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'tlob130_txt1.txt');
+>>extract lobtofile(LOB 'LOBH000000020001001830865086432349061818308650940724338718212359906984262764020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'tlob130_txt1.txt');
 Success. Targetfile :tlob130_txt1.txt  Length : 19
 
 --- SQL operation complete.
@@ -606,7 +670,7 @@ Success. Targetfile :tlob130_txt1.txt  Length : 19
 >>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 'LOBH0000000200010238590751241276057419238590751351241808618212357743351377111020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'tlob130_deep.jpg');
+>>extract lobtofile(LOB 'LOBH000000020001001830865086432359101818308650946460854518212359907041579214020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'tlob130_deep.jpg');
 Success. Targetfile :tlob130_deep.jpg  Length : 159018
 
 --- SQL operation complete.
@@ -622,7 +686,7 @@ Success. Targetfile :tlob130_deep.jpg  Length : 159018
 >>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 'LOBH0000000200010238590751241276057419238590751351241808618212357743351377111020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'tlob130_anoush.jpg');
+>>extract lobtofile(LOB 'LOBH000000020001001830865086432359101818308650946460854518212359907041579214020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'tlob130_anoush.jpg');
 Success. Targetfile :tlob130_anoush.jpg  Length : 230150
 
 --- SQL operation complete.
@@ -744,7 +808,7 @@ And the dish ran away with the fork !
 >>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/lobs\/tlob130_txt2.txt');/g" >> t130_extract_command;
 >>
 >>obey t130_extract_command;
->>extract lobtofile(LOB 'LOBH0000000200010238590751241278039119238590751361756602718212357743456430010020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'hdfs:///lobs/tlob130_txt2.txt');
+>>extract lobtofile(LOB 'LOBH000000020001001830865086432481141818308650954225440318212359907119296896020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'hdfs:///lobs/tlob130_txt2.txt');
 Success. Targetfile :hdfs:///lobs/tlob130_txt2.txt  Length : 19
 
 --- SQL operation complete.
@@ -760,7 +824,7 @@ Success. Targetfile :hdfs:///lobs/tlob130_txt2.txt  Length : 19
 >>sh rm t130_extract_command;
 >>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/lobs\/tlob130_deep.jpg');/g" >> t130_extract_command;
 >>obey t130_extract_command;
->>extract lobtofile(LOB 'LOBH0000000200010238590751241278182219238590751370769831118212357743546724266020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'hdfs:///lobs/tlob130_deep.jpg');
+>>extract lobtofile(LOB 'LOBH000000020001001830865086432492771818308650960155056018212359907178472834020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'hdfs:///lobs/tlob130_deep.jpg');
 Success. Targetfile :hdfs:///lobs/tlob130_deep.jpg  Length : 159018
 
 --- SQL operation complete.
@@ -776,7 +840,7 @@ Success. Targetfile :hdfs:///lobs/tlob130_deep.jpg  Length : 159018
 >>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/lobs\/tlob130_anoush.jpg');/g" >> t130_extract_command;
 >>
 >>obey t130_extract_command;
->>extract lobtofile(LOB 'LOBH0000000200010238590751241276057419238590751351241808618212357743351377111020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'hdfs:///lobs/tlob130_anoush.jpg');
+>>extract lobtofile(LOB 'LOBH000000020001001830865086432359101818308650946460854518212359907041579214020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'hdfs:///lobs/tlob130_anoush.jpg');
 Success. Targetfile :hdfs:///lobs/tlob130_anoush.jpg  Length : 230150
 
 --- SQL operation complete.
@@ -795,240 +859,33 @@ Column Name : c2
 Input a filename to extract to : 
 Output File Name : lobc2out.jpg
 Extracting  lob handle for column c2...
-LOB handle for c2: LOBH0000000200010238590751241276057419238590751351241808618212357743351377111020"TRAFODION"."LOB130"
+LOB handle for c2: LOBH000000020001001830865086432359101818308650946460854518212359907041579214020"TRAFODION"."LOB130"
 Extracting LOB data length for the above handle...
 LOB data length :230150
-Extracting lob data into file in chunks of 1000 ...
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
-Wrote 1000 bytes to file : lobc2out.jpg
+Extracting lob data into file in chunks ...
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
+Wrote 10000 bytes to file : lobc2out.jpg
 Wrote 150 bytes to file : lobc2out.jpg
 >>
 >>
@@ -1076,7 +933,7 @@ And the dish ran away with the spoon.
 >>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 'LOBH0000000200020238590751241280977919238590751387875790718212357743717775017020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'tlob130_deep2.jpg');
+>>extract lobtofile(LOB 'LOBH000000020002001830865086432700361818308650973720712718212359907314128843020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'tlob130_deep2.jpg');
 Success. Targetfile :tlob130_deep2.jpg  Length : 159018
 
 --- SQL operation complete.
@@ -1085,7 +942,7 @@ Success. Targetfile :tlob130_deep2.jpg  Length : 159018
 >>sh rm t130_extract_command;
 >>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'hdfs:\/\/\/lobs\/tlob130_anoush2.jpg');/g" >> t130_extract_command;
 >>obey t130_extract_command;
->>extract lobtofile(LOB 'LOBH0000000200030238590751241280977919238590751388595276918212357743725014951020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'hdfs:///lobs/tlob130_anoush2.jpg');
+>>extract lobtofile(LOB 'LOBH000000020003001830865086432700361818308650974204477218212359907318971086020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'hdfs:///lobs/tlob130_anoush2.jpg');
 Success. Targetfile :hdfs:///lobs/tlob130_anoush2.jpg  Length : 230150
 
 --- SQL operation complete.
@@ -1112,7 +969,7 @@ Hey diddle diddle,
 >>sh rm t130_extract_command;
 >>sh grep "^LOBH" TMP130 | sed "s/^/extract lobtofile(LOB '/g" | sed "s/$/' , 'tlob130_anoush3.jpg',create,truncate);/g" >> t130_extract_command;
 >>obey t130_extract_command;
->>extract lobtofile(LOB 'LOBH0000000200030238590751241281586319238590751394919981418212357743788172209020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                                     ' , 'tlob130_anoush3.jpg',create,truncate);
+>>extract lobtofile(LOB 'LOBH000000020003001830865086432746671818308650978649997618212359907363638742020"TRAFODION"."LOB130"                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
                                                     ' , 'tlob130_anoush3.jpg',create,truncate);
 Success. Targetfile :tlob130_anoush3.jpg  Length : 230150
 
 --- SQL operation complete.
@@ -1213,12 +1070,12 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130GT2
 
   ColumnName :  C2
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412857314_0001
+  LOB Data File:  LOBP_00183086508643303323_0001
   LOB EOD :  0
   LOB Used Len :  0
   ColumnName :  C3
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412857314_0002
+  LOB Data File:  LOBP_00183086508643303323_0002
   LOB EOD :  0
   LOB Used Len :  0
   ColumnName :  C4
@@ -1233,8 +1090,8 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130GT2
 CATALOG_NAME                                                                                                                                                                                                                                                      SCHEMA_NAME                                                                                                                                                                                                                                                       OBJECT_NAME                                                                                                                                                                                                                                                       COLUMN_NAME                                                                                                                                                                                                                    
                                    LOB_LOCATION                                                                                                                                                                                                                                                      LOB_DATA_FILE                                                                                                                                                                                                                                                     LOB_DATA_FILE_SIZE_EOD  LOB_DATA_FILE_SIZE_USED
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ---------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------  -----------------------
 
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT2                                                                                                                                                                                                                                                        C2                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412857314_0001                                                                                                                                                                                                                                                         0                        0
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT2                                                                                                                                                                                                                                                        C3                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412857314_0002                                                                                                                                                                                                                                                         0                        0
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT2                                                                                                                                                                                                                                                        C2                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643303323_0001                                                                                                                                                                                                                                                         0                        0
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT2                                                                                                                                                                                                                                                        C3                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643303323_0002                                                                                                                                                                                                                                                         0                        0
 TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT2                                                                                                                                                                                                                                                        C4                                                                                                                                                                                                                             
                                    External HDFS Location                                                                                                                                                                                                                                            External HDFS File                                                                                                                                                                                                                                                                     0                        0
 
 --- 3 row(s) selected.
@@ -1255,17 +1112,17 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130GT
 
   ColumnName :  C2
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412854101_0001
+  LOB Data File:  LOBP_00183086508643300979_0001
   LOB EOD :  15
   LOB Used Len :  15
   ColumnName :  C3
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412854101_0002
+  LOB Data File:  LOBP_00183086508643300979_0002
   LOB EOD :  15
   LOB Used Len :  15
   ColumnName :  C4
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412854101_0003
+  LOB Data File:  LOBP_00183086508643300979_0003
   LOB EOD :  45
   LOB Used Len :  45
 
@@ -1275,9 +1132,9 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130GT
 CATALOG_NAME                                                                                                                                                                                                                                                      SCHEMA_NAME                                                                                                                                                                                                                                                       OBJECT_NAME                                                                                                                                                                                                                                                       COLUMN_NAME                                                                                                                                                                                                                    
                                    LOB_LOCATION                                                                                                                                                                                                                                                      LOB_DATA_FILE                                                                                                                                                                                                                                                     LOB_DATA_FILE_SIZE_EOD  LOB_DATA_FILE_SIZE_USED
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ---------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------  -----------------------
 
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C2                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412854101_0001                                                                                                                                                                                                                                                        15                       15
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C3                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412854101_0002                                                                                                                                                                                                                                                        15                       15
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C4                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412854101_0003                                                                                                                                                                                                                                                        45                       45
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C2                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643300979_0001                                                                                                                                                                                                                                                        15                       15
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C3                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643300979_0002                                                                                                                                                                                                                                                        15                       15
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C4                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643300979_0003                                                                                                                                                                                                                                                        45                       45
 
 --- 3 row(s) selected.
 >>delete from tlob130gt where c1=2;
@@ -1294,17 +1151,17 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130GT
 
   ColumnName :  C2
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412854101_0001
+  LOB Data File:  LOBP_00183086508643300979_0001
   LOB EOD :  30
   LOB Used Len :  25
   ColumnName :  C3
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412854101_0002
+  LOB Data File:  LOBP_00183086508643300979_0002
   LOB EOD :  31
   LOB Used Len :  26
   ColumnName :  C4
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412854101_0003
+  LOB Data File:  LOBP_00183086508643300979_0003
   LOB EOD :  71
   LOB Used Len :  56
 
@@ -1314,9 +1171,9 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130GT
 CATALOG_NAME                                                                                                                                                                                                                                                      SCHEMA_NAME                                                                                                                                                                                                                                                       OBJECT_NAME                                                                                                                                                                                                                                                       COLUMN_NAME                                                                                                                                                                                                                    
                                    LOB_LOCATION                                                                                                                                                                                                                                                      LOB_DATA_FILE                                                                                                                                                                                                                                                     LOB_DATA_FILE_SIZE_EOD  LOB_DATA_FILE_SIZE_USED
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ---------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------  -----------------------
 
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C2                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412854101_0001                                                                                                                                                                                                                                                        30                       25
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C3                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412854101_0002                                                                                                                                                                                                                                                        31                       26
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C4                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_02385907512412854101_0003                                                                                                                                                                                                                                                        71                       56
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C2                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643300979_0001                                                                                                                                                                                                                                                        30                       25
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C3                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643300979_0002                                                                                                                                                                                                                                                        31                       26
+TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                                                                                                                                                                            TLOB130GT                                                                                                                                                                                                                                                         C4                                                                                                                                                                                                                             
                                    /lobs                                                                                                                                                                                                                                                             LOBP_00183086508643300979_0003                                                                                                                                                                                                                                                        71                       56
 
 --- 3 row(s) selected.
 >>
@@ -1325,6 +1182,12 @@ TRAFODION
 >>create table tlob130ext (c1 int not null, c2 blob, c3 clob, c4 blob storage 'external', primary key (c1));
 
 --- SQL operation complete.
+>>create table tlob130ext2 (c1 int not null, c2 blob, c3 clob, c4 blob storage 'external', primary key (c1));
+
+--- SQL operation complete.
+>>create table tlob130_not_external (c1 int not null , c2 blob, c3 blob, c4 blob, primary key (c1));
+
+--- SQL operation complete.
 >>insert into tlob130ext values(1, stringtolob('first lob'), filetolob('hdfs:///lobs/lob_input_a1.txt'),externaltolob('hdfs:///lobs/lob_input_a1.txt'));
 
 --- 1 row(s) inserted.
@@ -1405,8 +1268,7 @@ second lob                                          The cat and the fiddle,
                             The cat and the fiddle,
                           
 third lob                                           The cow jumped over the moon.
-                      The cow jumped over the moon.
-                    
+                      The cow jumped over the moon.                     
 
 --- 3 row(s) selected.
 >>update tlob130ext set c3=stringtolob('can allow this') where c1=1;
@@ -1423,8 +1285,7 @@ second lob                                          The cat and the fiddle,
                             The cat and the fiddle,
                           
 third lob                                           The cow jumped over the moon.
-                      The cow jumped over the moon.
-                    
+                      The cow jumped over the moon.                     
 
 --- 3 row(s) selected.
 >>
@@ -1446,8 +1307,7 @@ To see such sport,
 
 And th
 third lob                                           The cow jumped over the moon.
-                      The cow jumped over the moon.
-                    
+                      The cow jumped over the moon.                     
 
 --- 3 row(s) selected.
 >>
@@ -1478,12 +1338,12 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130EXT
 
   ColumnName :  C2
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412872171_0001
+  LOB Data File:  LOBP_00183086508643314774_0001
   LOB EOD :  70
   LOB Used Len :  42
   ColumnName :  C3
   Lob Location :  /lobs
-  LOB Data File:  LOBP_02385907512412872171_0002
+  LOB Data File:  LOBP_00183086508643314774_0002
   LOB EOD :  125
   LOB Used Len :  68
   ColumnName :  C4
@@ -1498,8 +1358,8 @@ Lob Information for table: "TRAFODION".LOB130.TLOB130EXT
 CATALOG_NAME                                                                                                                                                                                                                                                      SCHEMA_NAME                                                                                                                                                                                                                                                       OBJECT_NAME                                                                                                                                                                                                                                                       COLUMN_NAME                                                                                                                                                                                                                    
                                    LOB_LOCATION                                                                                                                                                                                                                                                      LOB_DATA_FILE                                                                                                                                                                                                                                                     LOB_DATA_FILE_SIZE_EOD  LOB_DATA_FILE_SIZE_USED
 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ---------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  ----------------------  -----------------------
 
-TRAFODION                                                                                                                                                                                                                                                         LOB130                                                                                                      

<TRUNCATED>


[3/7] incubator-trafodion git commit: Support for insert-select for tables containing LOB columns.

Posted by sa...@apache.org.
Support for insert-select for tables containing LOB columns.


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

Branch: refs/heads/master
Commit: b8cfdc87ec95694765ad2cd3ca892f95d0a1b5b2
Parents: f8c57fd
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Tue Apr 25 21:07:47 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Tue Apr 25 21:07:47 2017 +0000

----------------------------------------------------------------------
 core/sql/bin/clitest.cpp              |   2 +-
 core/sql/clitest/blobtest.cpp         |   4 +-
 core/sql/executor/ExExeUtilLoad.cpp   |   2 +-
 core/sql/exp/ExpLOB.cpp               |  65 ++--
 core/sql/exp/ExpLOB.h                 |  12 +-
 core/sql/exp/ExpLOBaccess.cpp         | 213 +++++++++++--
 core/sql/exp/ExpLOBaccess.h           |   9 +-
 core/sql/exp/ExpLOBenums.h            |   5 +-
 core/sql/exp/ExpLOBinterface.cpp      |  75 +++--
 core/sql/exp/ExpLOBinterface.h        |  34 ++-
 core/sql/generator/GenItemFunc.cpp    |   7 +-
 core/sql/generator/GenPreCode.cpp     |  52 ++--
 core/sql/optimizer/ItemFunc.h         |   2 +-
 core/sql/regress/executor/EXPECTED130 | 469 ++++++++++++-----------------
 core/sql/regress/executor/TEST130     |  37 ++-
 core/sql/sqlcomp/nadefaults.cpp       |   2 +-
 licenses/lic-pyinstall-src            |   4 +-
 17 files changed, 571 insertions(+), 423 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/bin/clitest.cpp
----------------------------------------------------------------------
diff --git a/core/sql/bin/clitest.cpp b/core/sql/bin/clitest.cpp
index 137943a..caff696 100644
--- a/core/sql/bin/clitest.cpp
+++ b/core/sql/bin/clitest.cpp
@@ -204,7 +204,7 @@ int main(int argc, const char * argv[])
 	}
       cout << "LOB data length :" << lengthOfLob << endl;
       //extract lob data to buffer
-      cout << "Extracting lob data into file in chunks of 1000 ..." << endl;
+      cout << "Extracting lob data into file in chunks ..." << endl;
       retCode = extractLobToFileInChunks(cliGlob,lobHandle, filename, lengthOfLob,columnname,tablename);
       if (retcode)
 	{

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/clitest/blobtest.cpp
----------------------------------------------------------------------
diff --git a/core/sql/clitest/blobtest.cpp b/core/sql/clitest/blobtest.cpp
index 843f05a..a9a457a 100644
--- a/core/sql/clitest/blobtest.cpp
+++ b/core/sql/clitest/blobtest.cpp
@@ -81,7 +81,7 @@ Int32 extractLobToBuffer(CliGlobals *cliglob, char * lobHandle, Int64 &lengthOfL
   char *lobFinalBuf = new char[lengthOfLob];
   char statusBuf[200] = {'\0'};
   Int32 statusBufLen = 0;
-  Int64 lobExtractLen = 1000;
+  Int64 lobExtractLen = 10000;
   char *lobDataBuf = new char[lobExtractLen];
   
   str_sprintf(query,"extract lobtobuffer(lob '%s', LOCATION %Ld, SIZE %Ld) ", lobHandle, (Int64)lobDataBuf, &lobExtractLen);
@@ -128,7 +128,7 @@ Int32 extractLobToFileInChunks(CliGlobals *cliglob,  char * lobHandle, char *fil
   
   char statusBuf[200] = {'\0'};
   Int32 statusBufLen = 0;
-  Int64 lobExtractLen = 1000;
+  Int64 lobExtractLen = 10000;
   char *lobDataBuf = new char[lobExtractLen];
   Int64 *inputOutputAddr = &lobExtractLen;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/executor/ExExeUtilLoad.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilLoad.cpp b/core/sql/executor/ExExeUtilLoad.cpp
index 6b8e6ac..c7129a9 100644
--- a/core/sql/executor/ExExeUtilLoad.cpp
+++ b/core/sql/executor/ExExeUtilLoad.cpp
@@ -3477,7 +3477,7 @@ short ExExeUtilLobUpdateTcb::work()
   if (lobTdb().getFromType() == ComTdbExeUtilLobUpdate::FROM_STRING_)
     so = Lob_Memory;
   else if (lobTdb().getFromType() == ComTdbExeUtilLobUpdate::FROM_EXTERNAL_)
-    so = Lob_External;
+    so = Lob_External_File;
   else if (lobTdb().getFromType() == ComTdbExeUtilLobUpdate::FROM_BUFFER_)  //Only this is supported
     so= Lob_Buffer;
   

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOB.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.cpp b/core/sql/exp/ExpLOB.cpp
index 447ce89..28cd1c1 100644
--- a/core/sql/exp/ExpLOB.cpp
+++ b/core/sql/exp/ExpLOB.cpp
@@ -743,18 +743,15 @@ ex_expr::exp_return_type ExpLOBiud::insertDesc(char *op_data[],
   else if (fromString() || fromLoad())
     so = Lob_Memory;
   else if (fromLob())
-    so = Lob_Foreign_Lob;
+    so = Lob_Lob;
+  else if (fromLobExternal())
+    so = Lob_External_Lob;
   else if (fromBuffer())
     so = Lob_Buffer;
   else if (fromExternal())
-    so = Lob_External;
+    so = Lob_External_File;
   else if (fromEmpty())
     {
-      /* str_cpy_all(result, lobHandle, handleLen);
-
-       getOperand(0)->setVarLength(handleLen, op_data[-MAX_OPERANDS]);
-      //we can return now - nothing to insert into the descriptors
-      return ex_expr::EXPR_OK; */
       so = Lob_Memory;
     }
 
@@ -784,7 +781,7 @@ ex_expr::exp_return_type ExpLOBiud::insertDesc(char *op_data[],
   // until SQL_EXEC_LOBcliInterface is changed to allow for unlimited
   // black box sizes, we have to prevent over-sized file names from
   // being stored
-  if ((so == Lob_External) && (lobLen > MAX_LOB_FILE_NAME_LEN))
+  if ((so == Lob_External_File) && (lobLen > MAX_LOB_FILE_NAME_LEN))
     {
       ExRaiseSqlError(h, diagsArea, 
 		      (ExeErrorCode)(8557));
@@ -803,7 +800,7 @@ ex_expr::exp_return_type ExpLOBiud::insertDesc(char *op_data[],
   char * lobData = NULL;
   lobData= new(h) char[lobLen];
   //send lobData only if it's a lob_file operation
-  if ((so == Lob_File) || (so == Lob_External))
+  if ((so == Lob_File) || (so == Lob_External_File) || (so == Lob_Lob) || (so == Lob_External_Lob))
     {
       str_cpy_and_null(lobData,op_data[1],lobLen,'\0',' ',TRUE);
       
@@ -828,6 +825,21 @@ ex_expr::exp_return_type ExpLOBiud::insertDesc(char *op_data[],
   else
     lobMaxSize = getLobMaxSize();
     
+  if ((so == Lob_Lob) || (so == Lob_External_Lob))
+    {
+      
+      rc = ExpLOBInterfaceInsertSelect
+        (getExeGlobals()->getExLobGlobal(), 
+         getLobHdfsServer(), getLobHdfsPort(),
+         tgtLobName, 
+         so,
+         lobStorageLocation(),lobStorageType(),
+         getExeGlobals()->lobGlobals()->xnId(),
+         handleLen, lobHandle,  &outHandleLen_, outLobHandle_,            
+         lobData, lobLen, blackBox_, blackBoxLen_,lobMaxSize, getLobMaxChunkMemSize(),getLobGCLimit()); 
+        
+    }
+else
   rc = ExpLOBInterfaceInsert
     (getExeGlobals()->getExLobGlobal(), 
      tgtLobName, 
@@ -931,9 +943,11 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
         lobLen = getOperand(1)->getLength(op_data[1]- getOperand(1)->getVCIndicatorLength());  
     }
   char * lobData = NULL;
-  if (fromExternal())
+  if (fromExternal() || fromLob() || fromLobExternal())
     {
       //no need to insert any data. All data resides in the external file
+      // for external LOB and it has already been read/inserted during 
+      // ::insertDesc for insert from another  LOB
       return ex_expr::EXPR_OK;
     }
   if(fromFile())
@@ -965,11 +979,11 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
   else if (fromString() || fromLoad())
     so = Lob_Memory;
   else if (fromLob())
-    so = Lob_Foreign_Lob;
+    so = Lob_Lob;
   else if(fromBuffer())
     so = Lob_Buffer;
   else if (fromExternal())
-    so = Lob_External;
+    so = Lob_External_File;
 
  
   Lng32 waitedOp = 0;
@@ -986,26 +1000,7 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
 
   blackBoxLen_ = 0;
 
-  if (fromLob())
-    {
-      Int64 srcDescKey = -1;
-      Int64 srcDescTS = -1;
-      char srcLobNameBuf[100];
-      char * srcLobName = NULL;
-      short srcSchNameLen = 0;
-      char  srcSchName[500];
-      extractFromLOBhandle(NULL, &lobType, &lobNum, &uid,
-			   &srcDescKey, &srcDescTS, 
-			   &srcSchNameLen, srcSchName,
-			   op_data[1]);
-      
-      // get the lob name where data will be read from
-      srcLobName = ExpGetLOBname(uid, lobNum, srcLobNameBuf, 100);
-      if (srcLobName == NULL)
-	return ex_expr::EXPR_ERROR;
-    }
-  else
-    {
+  
       rc = ExpLOBInterfaceInsert(getExeGlobals()->getExLobGlobal(),
 				 tgtLobName, 
 				 lobStorageLocation(),
@@ -1029,7 +1024,7 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
 				 lobLen,getLobMaxSize(),
                                  getLobMaxChunkMemSize(),
                                  getLobGCLimit());
-    }
+    
 
   if (rc == LOB_ACCESS_PREEMPT)
     {
@@ -1334,11 +1329,11 @@ ex_expr::exp_return_type ExpLOBupdate::eval(char *op_data[],
   else if (fromString())
     so = Lob_Memory;
   else if (fromLob())
-    so = Lob_Foreign_Lob;
+    so = Lob_Lob;
   else if (fromBuffer())
     so= Lob_Buffer;
   else if (fromExternal())
-    so = Lob_External;
+    so = Lob_External_File;
  
    
  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOB.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.h b/core/sql/exp/ExpLOB.h
index 296fe69..66f213c 100644
--- a/core/sql/exp/ExpLOB.h
+++ b/core/sql/exp/ExpLOB.h
@@ -488,6 +488,15 @@ class ExpLOBiud : public ExpLOBoper {
   {
     (v) ? liudFlags_ |= FROM_LOB: liudFlags_ &= ~FROM_LOB;
   };
+  NA_EIDPROC NABoolean fromLobExternal()
+  {
+    return ((liudFlags_ & FROM_LOB_EXTERNAL) != 0);
+  };
+
+  NA_EIDPROC inline void setFromLobExternal(NABoolean v)
+  {
+    (v) ? liudFlags_ |= FROM_LOB_EXTERNAL: liudFlags_ &= ~FROM_LOB_EXTERNAL;
+  };
 
   NA_EIDPROC NABoolean fromExternal()
   {
@@ -512,7 +521,8 @@ class ExpLOBiud : public ExpLOBoper {
     FROM_LOB           = 0x0010,
     FROM_EXTERNAL      = 0x0020,
     FROM_BUFFER        = 0x0040,
-    FROM_EMPTY         = 0x0080
+    FROM_EMPTY         = 0x0080,
+    FROM_LOB_EXTERNAL  = 0x0100
   };
 
   Lng32 liudFlags_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index 27d5011..46b4c90 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -58,6 +58,7 @@
 #include "ExpLOBaccess.h"
 #include "ExpLOBinterface.h"
 #include "ExpLOBexternal.h"
+#include "ExpLOB.h"
 #include "NAVersionedObject.h"
 #include "ComQueue.h"
 #include "QRLogger.h"
@@ -803,7 +804,7 @@ Ex_Lob_Error ExLob::readExternalSourceFile(char *srcfile, char *&fileData, Int32
   return LOB_OPER_OK;
 }
 
-Ex_Lob_Error ExLob::writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOper, Int64 &descNumOut, Int64 &operLen, Int64 lobMaxSize,Int64 lobMaxChunkMemSize,Int64 lobGCLimit, char * handleIn, Int32 handleInLen, char *blackBox, Int32 *blackBoxLen, char *handleOut, Int32 &handleOutLen, void *lobGlobals)
+Ex_Lob_Error ExLob::writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOper, Int64 &descNumOut, Int64 &operLen, Int64 lobMaxSize,Int64 lobMaxChunkMemSize,Int64 lobGCLimit, char * handleIn, Int32 handleInLen, char *blackBox, Int32 *blackBoxLen, char *handleOut, Int32 &handleOutLen, Int64 xnId, void *lobGlobals)
 {
   Ex_Lob_Error err=LOB_OPER_OK; 
     Int64 dataOffset = 0;
@@ -813,8 +814,15 @@ Ex_Lob_Error ExLob::writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOpe
     char logBuf[4096];
   
     lobDebugInfo("In ExLob::writeDesc",0,__LINE__,lobTrace_);
+    //if external lob input, make sure it resides in hdfs
+    if (subOper == Lob_External_File)
+      {
+       LobInputOutputFileType srcFileType = fileType(source);
+       if (srcFileType != HDFS_FILE)
+         return  LOB_SOURCE_FILE_READ_ERROR;
+      }
     // Calculate sourceLen for each subOper.
-    if ((subOper == Lob_File)||(subOper == Lob_External))
+    if ((subOper == Lob_File))
       {
 	err = statSourceFile(source, sourceLen); 
 	if (err != LOB_OPER_OK)
@@ -823,9 +831,9 @@ Ex_Lob_Error ExLob::writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOpe
     if (sourceLen < 0 || sourceLen > lobMaxSize)
       {
 	return LOB_MAX_LIMIT_ERROR; //exceeded the size of the max lob size
-        //TBD trigger compaction
+        
       }
-    if (subOper != Lob_External) 
+    if (subOper != Lob_External_File) 
       {
         lobDebugInfo("Calling ExLob::allocateDesc",0,__LINE__,lobTrace_);
         err = allocateDesc((unsigned int)sourceLen, descNumOut, dataOffset, lobMaxSize, lobMaxChunkMemSize,handleIn, handleInLen, lobGCLimit,lobGlobals);
@@ -845,7 +853,7 @@ Ex_Lob_Error ExLob::writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOpe
                                      &dataOffset, &sourceLen,
                                      &outDescPartnKey, &outDescSyskey, 
 				     0,
-				     0,lobTrace_);
+				     xnId,lobTrace_);
     if (clierr < 0 ) {
       str_sprintf(logBuf,"CLI LOB_CLI_INSERT returned error %d",clierr);
       lobDebugInfo(logBuf, 0,__LINE__,lobTrace_);
@@ -856,7 +864,7 @@ Ex_Lob_Error ExLob::writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOpe
 }
 
 
-Ex_Lob_Error ExLob::insertDesc(Int64 offset, Int64 size,  char *handleIn, Int32 handleInLen,  char *handleOut, Int32 &handleOutLen, char *blackBox, Int32 blackBoxLen,void *lobGlobals) 
+Ex_Lob_Error ExLob::insertDesc(Int64 offset, Int64 size,  char *handleIn, Int32 handleInLen,  char *handleOut, Int32 &handleOutLen, char *blackBox, Int32 blackBoxLen,Int64 xnId, void *lobGlobals) 
 {
   
    Lng32 clierr;
@@ -880,7 +888,7 @@ Ex_Lob_Error ExLob::insertDesc(Int64 offset, Int64 size,  char *handleIn, Int32
                                      &offset, &size,
                                      &outDescPartnKey, &outDescSyskey, 
 				     0,
-				     0,lobTrace_);
+				     xnId,lobTrace_);
    str_sprintf(logBuf,"After LOB_CLI_INSERT: ChunkNum: OutSyskey:%Ld",
                chunkNum,outDescSyskey);
    lobDebugInfo(logBuf,0,__LINE__,lobTrace_);
@@ -903,7 +911,7 @@ Ex_Lob_Error ExLob::writeLobData(char *source, Int64 sourceLen, LobsSubOper subO
     Int32 allocMemSize = 0;
     Int64 inputSize = sourceLen;
     Int64 writeOffset = tgtOffset;
-    if (subOperation == Lob_External)
+    if (subOperation == Lob_External_File)
       return LOB_OPER_OK;
     while(inputSize > 0)
       {
@@ -973,7 +981,7 @@ Ex_Lob_Error ExLob::readToMem(char *memAddr, Int64 size,  Int64 &operLen,char *
        return err;
      }
    sizeToRead = MINOF(size,desc.getSize());
-   if (blackBox)
+   if (blackBox && blackBoxLen >0 )
      {
        
        // we have received the external data file name from the descriptor table
@@ -1082,7 +1090,103 @@ Ex_Lob_Error ExLob::readToFile(char *tgtFileName, Int64 tgtLength, Int64 &operLe
   return LOB_OPER_OK;
 }
 
-Ex_Lob_Error ExLob::append(char *data, Int64 size, LobsSubOper so, Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize,Int64 lobMaxChunkMemSize, Int64 lobGCLimit, char *handleIn, Int32 handleInLen,  char * handleOut, Int32 &handleOutLen,void *lobGlobals)
+
+Ex_Lob_Error ExLob::insertSelect(ExLob *srcLobPtr,
+                                 char *handleIn,Int32 handleInLen,char *source,
+                                 Int64 sourceLen, Int64 &operLen,
+                                 Int64 lobMaxSize, Int64 lobMaxChunkMemLen,
+                                 Int64 lobGCLimit, char *blackBox, 
+                                 Int32 blackBoxLen,char *handleOut, 
+                                 Int32 &handleOutLen,LobsSubOper so, Int64 xnId,void *lobGlobals)
+{
+  Ex_Lob_Error err = LOB_OPER_OK;
+  Int32 cliRC;
+  Int16 flags;
+  Lng32  lobNum;
+  Int64 descNumOut,descNumIn,descSyskey = 0;
+  Int32 lobType = 0;
+  Int64 uid, inDescSyskey, descPartnKey;
+  short schNameLen;
+  char schName[1024];
+  Int64 inputLobDataLen = 0;
+  Int64 retOperLen = 0; 
+  Int64 dummy = 0;
+  char logBuf[4096];
+  char sourceHandle[LOB_HANDLE_LEN]  = {};
+ 
+  str_cpy_all(sourceHandle, source, sourceLen);
+
+  if (so == Lob_External_Lob)
+    {
+      ExLobDesc desc;
+      char extFileName[MAX_LOB_FILE_NAME_LEN+6];
+      Int64 extFileNameLen = 0;
+      // retrieve the external file name from the source log descriptor
+      err = getDesc(desc,sourceHandle,sourceLen,blackBox,&blackBoxLen,handleOut,handleOutLen,xnId);
+      if (err != LOB_OPER_OK)
+        return LOB_DESC_READ_ERROR;
+      // we have received the external data file name from the descriptor table
+      // replace the contents of the lobDataFile with this name      
+      str_cpy_all(extFileName, blackBox, blackBoxLen);
+      extFileNameLen = blackBoxLen;
+      // Now insert this into the target lob descriptor
+      
+      err = writeDesc(extFileNameLen, extFileName, Lob_External_File, descNumOut, 
+                      retOperLen, lobMaxSize, lobMaxChunkMemLen,lobGCLimit,
+                      handleIn,handleInLen,(char *)blackBox, &blackBoxLen,
+                      handleOut,handleOutLen,xnId,lobGlobals);
+ 
+      if (err != LOB_OPER_OK)
+        return err;
+      return err;
+    }
+  // First retrieve length of the lob pointed to by source (input handle) 
+  cliRC = SQL_EXEC_LOBcliInterface(sourceHandle, sourceLen,
+                                   NULL,NULL,NULL,NULL,
+                                   LOB_CLI_SELECT_LOBLENGTH,LOB_CLI_ExecImmed,
+                                   0,&inputLobDataLen, &dummy, &dummy,0,0,FALSE);
+  if (cliRC < 0)
+    {
+      str_sprintf(logBuf,"cli LOB_CLI_SElECT_LOBLENGTH returned :%d", cliRC);
+      lobDebugInfo(logBuf, 0,__LINE__,lobTrace_);   
+      return LOB_DESC_READ_ERROR;
+    }
+      		   
+  // Allocate memory to hold the lob data from the input lob handle
+  char *inputLobData = (char *)(getLobGlobalHeap()->allocateMemory(inputLobDataLen));
+  // retrieve the section/sections from the lob pointed to by the input handle
+  // into memory
+  err = srcLobPtr->readToMem(inputLobData, inputLobDataLen,retOperLen, 
+                             sourceHandle,sourceLen,
+                             blackBox, blackBoxLen,
+                             handleOut, handleOutLen,xnId);
+  if (err != LOB_OPER_OK)
+    return err;
+
+  
+  // write the lob data into the target lob 
+  
+
+  err = writeDesc(inputLobDataLen, inputLobData, Lob_Memory, descNumOut, retOperLen, lobMaxSize, lobMaxChunkMemLen,lobGCLimit,handleIn,handleInLen,(char *)blackBox, &blackBoxLen,handleOut,handleOutLen,xnId,lobGlobals);
+ 
+  if (err != LOB_OPER_OK)
+    return err;
+  if (handleOutLen > 0)
+    {
+      ExpLOBoper::extractFromLOBhandle(NULL, &lobType, NULL, NULL, &descSyskey,
+				       NULL, NULL, NULL, handleOut);
+      
+      ExpLOBoper::updLOBhandle(descSyskey, 0, handleIn); 
+    }
+
+  err =  insertData(inputLobData, inputLobDataLen, Lob_Memory, descNumIn, retOperLen, lobMaxSize,lobMaxChunkMemLen,handleIn,handleInLen,(char *)blackBox, blackBoxLen,handleOut,handleOutLen,lobGlobals);
+  
+  if (err != LOB_OPER_OK)
+    return err;
+  return LOB_OPER_OK;
+}
+
+Ex_Lob_Error ExLob::append(char *data, Int64 size, LobsSubOper so, Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize,Int64 lobMaxChunkMemSize, Int64 lobGCLimit, char *handleIn, Int32 handleInLen,  char * handleOut, Int32 &handleOutLen,Int64 xnId,void *lobGlobals)
 {
     Ex_Lob_Error err = LOB_OPER_OK;
     Int64 dummyParam;
@@ -1095,7 +1199,7 @@ Ex_Lob_Error ExLob::append(char *data, Int64 size, LobsSubOper so, Int64 headDes
     char *blackBox = NULL;
     Int32 blackBoxLen = 0;
 
-    if (so ==Lob_External)
+    if (so ==Lob_External_File)
       {
         blackBox = data;
         blackBoxLen = (Int32)size;
@@ -1126,7 +1230,7 @@ Ex_Lob_Error ExLob::append(char *data, Int64 size, LobsSubOper so, Int64 headDes
                                       &dataOffset, &sourceLen,
                                       &outDescPartnKey, &outDescSyskey, 
 				      0,
-				      0,lobTrace_);
+				      xnId,lobTrace_);
     
     
     if (clierr < 0 || clierr == 100) { // some error or EOD.
@@ -1185,7 +1289,7 @@ Ex_Lob_Error ExLob::insertData(char *data, Int64 size, LobsSubOper so,Int64 head
     }
     return LOB_OPER_OK;
 }
-Ex_Lob_Error ExLob::update(char *data, Int64 size, LobsSubOper so,Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemSize, Int64 lobGCLimit, char *handleIn, Int32 handleInLen,  char *handleOut, Int32 &handleOutLen, void *lobGlobals)
+Ex_Lob_Error ExLob::update(char *data, Int64 size, LobsSubOper so,Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemSize, Int64 lobGCLimit, char *handleIn, Int32 handleInLen,  char *handleOut, Int32 &handleOutLen, Int64 xnId,void *lobGlobals)
 {
     Ex_Lob_Error err = LOB_OPER_OK;
     Int64 dummyParam;
@@ -1198,13 +1302,13 @@ Ex_Lob_Error ExLob::update(char *data, Int64 size, LobsSubOper so,Int64 headDesc
     char *blackBox = NULL;
     Int32 blackBoxLen = 0;
 
-    if (so == Lob_External)
+    if (so == Lob_External_File)
       {
         blackBox = data;
         blackBoxLen = (Int32)size;
       }
     lobDebugInfo("In ExLob::update",0,__LINE__,lobTrace_);
-    if ((so == Lob_File) || (so == Lob_External))
+    if ((so == Lob_File) || (so == Lob_External_File))
       {
         str_sprintf(logBuf,"Calling statSourceFile: source:%s, sourceLen: %Ld",
                data,sourceLen);
@@ -1213,7 +1317,7 @@ Ex_Lob_Error ExLob::update(char *data, Int64 size, LobsSubOper so,Int64 headDesc
 	if (err != LOB_OPER_OK)
 	  return err;
       }
-    if(so != Lob_External)
+    if(so != Lob_External_File)
       {
         if (sourceLen < 0 || sourceLen > lobMaxSize)
           {
@@ -1233,7 +1337,7 @@ Ex_Lob_Error ExLob::update(char *data, Int64 size, LobsSubOper so,Int64 headDesc
                                       &dataOffset, &sourceLen,
                                       &outDescPartnKey, &outDescSyskey, 
 				      0,
-				      0,lobTrace_);
+				      xnId,lobTrace_);
     
     if (clierr < 0 || clierr == 100) { // some error or EOD.
       
@@ -2435,11 +2539,13 @@ Ex_Lob_Error ExLobsOper (
       break;
 
     case Lob_InsertDesc:
-      err = lobPtr->writeDesc(sourceLen, source, subOperation, descNumOut, retOperLen, lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,(char *)blackBox, &blackBoxLen,handleOut,handleOutLen,lobGlobals);
+      
+      err = lobPtr->writeDesc(sourceLen, source, subOperation, descNumOut, retOperLen, lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,(char *)blackBox, &blackBoxLen,handleOut,handleOutLen,transId,lobGlobals);
       if (err != LOB_OPER_OK)
         {
           lobDebugInfo("writeDesc failed ",err,__LINE__,lobGlobals->lobTrace_);
         }
+        
       break;
 
     case Lob_InsertData:
@@ -2454,7 +2560,55 @@ Ex_Lob_Error ExLobsOper (
       err = lobPtr->writeDataSimple(source, sourceLen, subOperation, retOperLen,
 				    bufferSize , replication , blockSize);
       break;
+    case Lob_InsSel:
+      {
+        
+        ExLob *srcLobPtr;
+        Int16 flags;
+        Lng32  lobNum;
+        Int32 lobType;
+        Int64 uid, inDescSyskey, descPartnKey;
+        short schNameLen;
+        char schName[1024];
+        char sourceHandle[512]  = {};
+        str_cpy_all(sourceHandle, source, sourceLen);
+        ExpLOBoper::extractFromLOBhandle(&flags, &lobType, &lobNum, &uid,  
+                                   &inDescSyskey, &descPartnKey,
+                                   &schNameLen, schName,
+                                   sourceHandle); 
+        char srcLobNameBuf[100];
+        char * srcLobName = 
+          ExpLOBoper::ExpGetLOBname(uid, lobNum, srcLobNameBuf, 100);
+        lobMap_it it2;
+        it2 = lobMap->find(string(srcLobName));
+
+        if (it2 == lobMap->end())
+	{
+	  srcLobPtr = new (lobGlobals->getHeap())ExLob(lobGlobals->getHeap());
+	  if (srcLobPtr == NULL) 
+	    return LOB_ALLOC_ERROR;
+
+	  err = srcLobPtr->initialize(srcLobName, EX_LOB_RW, lobStorageLocation, storage, hdfsServer, hdfsPort, lobStorageLocation,bufferSize, replication, blockSize,lobMaxSize,lobGlobals);
+	  if (err != LOB_OPER_OK)
+            {
+              char buf[5000];
+              str_sprintf(buf,"Lob initialization failed;filename:%s;location:%s;hdfsserver:%s;hdfsPort:%d;lobMaxSize:%Ld",srcLobName,lobStorageLocation,hdfsServer,lobMaxSize);
+              lobDebugInfo(buf,err,__LINE__,lobGlobals->lobTrace_);
+              return err;
+            }
+
+	  lobMap->insert(pair<string, ExLob*>(string(srcLobName), srcLobPtr));
+	}
+      else	
+        srcLobPtr = it2->second;
 
+        err = lobPtr->insertSelect(srcLobPtr,handleIn, handleInLen, source, sourceLen, retOperLen, lobMaxSize, lobMaxChunkMemSize,lobGCLimit,(char *)blackBox, blackBoxLen,handleOut,handleOutLen,subOperation,transId, lobGlobals);
+        if (err != LOB_OPER_OK)
+          {
+            lobDebugInfo("insertSelect failed ",err,__LINE__,lobGlobals->lobTrace_);
+          }
+      }
+      break;
     case Lob_Read:
       if (storage == Lob_External_HDFS_File)   
         //Allocate storage to read the lob external file name from the 
@@ -2546,10 +2700,6 @@ Ex_Lob_Error ExLobsOper (
       if (lobPtr->hasNoOpenCursors()) {
 	lobGlobals->traceMessage("Lob_CloseFile",NULL,__LINE__);
 	err = lobPtr->closeFile();
-	it = lobMap->find(string(lobName));
-	lobMap->erase(it);
-	delete lobPtr;
-	lobPtr = NULL;
       }  
       break;
 
@@ -2572,9 +2722,9 @@ Ex_Lob_Error ExLobsOper (
       break;
 
     case Lob_Append:
-      if ((subOperation == Lob_Memory) ||(subOperation == Lob_Buffer) || (subOperation ==Lob_External))
+      if ((subOperation == Lob_Memory) ||(subOperation == Lob_Buffer) || (subOperation ==Lob_External_File))
         {
-          err = lobPtr->append(source, sourceLen, subOperation, descNumIn, retOperLen,lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,lobGlobals);
+          err = lobPtr->append(source, sourceLen, subOperation, descNumIn, retOperLen,lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,transId, lobGlobals);
           if (err != LOB_OPER_OK)
             {
               lobDebugInfo("append(Memory,Buffer) failed ",err,__LINE__,lobGlobals->lobTrace_);
@@ -2582,7 +2732,7 @@ Ex_Lob_Error ExLobsOper (
         }
       else if (subOperation == Lob_File)
         {
-          err = lobPtr->append(source, -1, subOperation, descNumIn, retOperLen,lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,lobGlobals);
+          err = lobPtr->append(source, -1, subOperation, descNumIn, retOperLen,lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,transId,lobGlobals);
           if (err != LOB_OPER_OK)
             {
               lobDebugInfo("append(File) failed ",err,__LINE__,lobGlobals->lobTrace_);
@@ -2593,9 +2743,9 @@ Ex_Lob_Error ExLobsOper (
       break;
 
     case Lob_Update:
-      if ((subOperation == Lob_Memory)||(subOperation == Lob_Buffer)||(subOperation ==Lob_External))
+      if ((subOperation == Lob_Memory)||(subOperation == Lob_Buffer)||(subOperation ==Lob_External_File))
         {
-          err = lobPtr->update(source, sourceLen, subOperation, descNumIn, retOperLen, lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,lobGlobals);
+          err = lobPtr->update(source, sourceLen, subOperation, descNumIn, retOperLen, lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,transId, lobGlobals);
           if (err != LOB_OPER_OK)
             {
               lobDebugInfo("update(Memory,Buffer) failed ",err,__LINE__,lobGlobals->lobTrace_);
@@ -2603,7 +2753,7 @@ Ex_Lob_Error ExLobsOper (
         }
       else if (subOperation == Lob_File)
         {
-          err = lobPtr->update(source, -1, subOperation,descNumIn, retOperLen,lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,lobGlobals); 
+          err = lobPtr->update(source, -1, subOperation,descNumIn, retOperLen,lobMaxSize, lobMaxChunkMemSize,lobGCLimit,handleIn,handleInLen,handleOut,handleOutLen,transId,lobGlobals); 
           if (err != LOB_OPER_OK)
             {
               lobDebugInfo("update(Memory,Buffer) failed ",err,__LINE__,lobGlobals->lobTrace_);
@@ -3182,6 +3332,13 @@ ExLobGlobals::~ExLobGlobals()
            numWorkerThreads_--;
        }
     }
+
+    //Free the preOpenList AFTER the worker threads have left to avoid the 
+    //case where a slow worker thread is still processing a preOpen and 
+    //may access the preOpenList.
+    preOpenListLock_.lock();
+    preOpenList_.clear();
+    preOpenListLock_.unlock();
     // Free the post fetch bugf list AFTER the worker threads have left to 
     // avoid slow worker thread being stuck and master deallocating these 
     // buffers and not consuming the buffers which could cause a  lock.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOBaccess.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.h b/core/sql/exp/ExpLOBaccess.h
index 3d981b4..7d97e19 100644
--- a/core/sql/exp/ExpLOBaccess.h
+++ b/core/sql/exp/ExpLOBaccess.h
@@ -413,7 +413,7 @@ class ExLob : public NABasicObject
                             int blocksize=0, Int64 lobMaxSize = 0, 
                             ExLobGlobals *lobGlobals = NULL);
 
-  Ex_Lob_Error writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOperation, Int64 &descNumOut, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemSize,Int64 lobGCLimit, char * handleIn, Int32 handleInLen, char *blackBox, Int32 *blackBoxLen, char * handleOut, Int32 &handleOutLen, void *lobGlobals);
+  Ex_Lob_Error writeDesc(Int64 &sourceLen, char *source, LobsSubOper subOperation, Int64 &descNumOut, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemSize,Int64 lobGCLimit, char * handleIn, Int32 handleInLen, char *blackBox, Int32 *blackBoxLen, char * handleOut, Int32 &handleOutLen, Int64 xnId,void *lobGlobals);
     Ex_Lob_Error writeLobData(char *source, Int64 sourceLen, 
 			      LobsSubOper subOperation, 
 			      Int64 tgtOffset,Int64 &operLen, 
@@ -433,8 +433,9 @@ class ExLob : public NABasicObject
     Ex_Lob_Error deleteCursor(const char *cursorName, ExLobGlobals *lobGlobals);
   Ex_Lob_Error fetchCursor(char *handleIn, Int32 handleLenIn, Int64 &outOffset, Int64 &outSize,NABoolean &isEOD,Int64 transId);
   Ex_Lob_Error insertData(char *data, Int64 size, LobsSubOper so,Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemSize,char *handleIn,Int32 handleInLen, char *blackBox, Int32 blackBoxLen, char * handleOut, Int32 &handleOutLen, void *lobGlobals);
-  Ex_Lob_Error append(char *data, Int64 size, LobsSubOper so, Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemLen,Int64 lobGCLimit, char *handleIn,Int32 handleInLen, char * handleOut, Int32 &handleOutLen, void *lobGlobals);
-  Ex_Lob_Error update(char *data, Int64 size, LobsSubOper so,Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize,Int64 lobMaxChunkMemLen,Int64 lobGCLimit,char *handleIn,Int32 handleInLen, char * handleOut, Int32 &handleOutLen, void *lobGlobals);
+  Ex_Lob_Error insertSelect(ExLob *srcLobPtr,char *handleIn,Int32 handleInLen, char *source, Int64 sourceLen, Int64 &operLen,Int64 lobMaxSize, Int64 lobMaxChunkMemLen,Int64 lobGCLimit, char *blackBox, Int32 blackBoxLen, char *handleOut, Int32 &handleOutLen,LobsSubOper so,Int64 xnId,void *lobGlobals);
+  Ex_Lob_Error append(char *data, Int64 size, LobsSubOper so, Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize, Int64 lobMaxChunkMemLen,Int64 lobGCLimit, char *handleIn,Int32 handleInLen, char * handleOut, Int32 &handleOutLen, Int64 xnId,void *lobGlobals);
+  Ex_Lob_Error update(char *data, Int64 size, LobsSubOper so,Int64 headDescNum, Int64 &operLen, Int64 lobMaxSize,Int64 lobMaxChunkMemLen,Int64 lobGCLimit,char *handleIn,Int32 handleInLen, char * handleOut, Int32 &handleOutLen, Int64 xnId,void *lobGlobals);
   Ex_Lob_Error readSourceFile(char *srcfile, char *&fileData, Int32 &size, Int64 offset);
   Ex_Lob_Error readHdfsSourceFile(char *srcfile, char *&fileData, Int32 &size, Int64 offset);
   Ex_Lob_Error readLocalSourceFile(char *srcfile, char *&fileData, Int32 &size, Int64 offset);
@@ -454,7 +455,7 @@ class ExLob : public NABasicObject
   Ex_Lob_Error readStats(char *buffer);
   Ex_Lob_Error initStats();
   
-  Ex_Lob_Error insertDesc(Int64 offset, Int64 size,  char *handleIn, Int32 handleInLen,  char *handleOut, Int32 &handleOutLen, char *blackBox, Int32 blackBoxLen,void *lobGlobals) ;
+  Ex_Lob_Error insertDesc(Int64 offset, Int64 size,  char *handleIn, Int32 handleInLen,  char *handleOut, Int32 &handleOutLen, char *blackBox, Int32 blackBoxLen,Int64 xnId,void *lobGlobals) ;
   
   Ex_Lob_Error lockDesc();
   Ex_Lob_Error unlockDesc();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOBenums.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBenums.h b/core/sql/exp/ExpLOBenums.h
index 3f46d37..d63a0e2 100644
--- a/core/sql/exp/ExpLOBenums.h
+++ b/core/sql/exp/ExpLOBenums.h
@@ -178,8 +178,9 @@ typedef enum {
    Lob_File,
    Lob_Memory,
    Lob_Buffer,
-   Lob_Foreign_Lob,
-   Lob_External
+   Lob_Lob, // tranfer from lob column of one table to another
+   Lob_External_Lob,//transfer from external lob of one table to another
+   Lob_External_File // link external hdfs file into traf lob column without an hdfs copy. 
 } LobsSubOper;
 
 typedef enum {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOBinterface.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBinterface.cpp b/core/sql/exp/ExpLOBinterface.cpp
index 4634eec..42a85c7 100644
--- a/core/sql/exp/ExpLOBinterface.cpp
+++ b/core/sql/exp/ExpLOBinterface.cpp
@@ -559,49 +559,66 @@ Lng32 ExpLOBInterfaceInsertSelect(void * exLobGlob,
 				  char * lobHdfsServer ,
 				  Lng32 lobHdfsPort ,
 				  char * tgtLobName,
+                                  LobsSubOper so,
 				  char * lobStorageLocation,
-				  
-				  Lng32 handleLen,
+                                  Int32 lobType,
+                                  Int64 xnId,
+				   Lng32 handleLen,
 				  char * lobHandle,
+                                  Int32 *outHandleLen,
+                                  char * outLobHandle,
+                                  char * lobData, 
+                                  Int64 lobLen,
+                                  char * blackBox,
+                                  Int64 blackBoxLen,
+                                  Int64 lobMaxSize,
+                                  Int64 lobMaxChunkMemSize ,
+                                  Int64 lobGCLimit ,
+                                  int    bufferSize ,
+                                  short  replication ,
+                                  int    blocksize
 				  
-				  Int64 &descSyskey,
-				  Int64 &lobLen,
-				  
-				  char * lobData, 
-				  
-				  char * srcLobName, 
-				  short srcDescSchNameLen,
-				  char * srcDescSchName,
-				  
-				  Int64 srcDescKey, 
-				  Int64 srcDescTS)
+				 )
 {
   Ex_Lob_Error err;
 
-  LobsSubOper lso = Lob_Foreign_Lob;
+  
   Ex_Lob_Error status;
   Int64 dummyParam=0;
   Int32 dummyParam2 = 0;
   Int64 cliError = -1;
-
+  LobsStorage ls = (LobsStorage)lobType;
+ 
   err = ExLobsOper(tgtLobName, 
 		   lobHandle, handleLen, 
-		   NULL, 0, // hdfs server/port
-                   NULL, dummyParam2, -1, descSyskey, lobLen,
-                   0, dummyParam, status, cliError, 
-		   lobStorageLocation, Lob_HDFS_File,
-		   lobData, lobLen, //strlen(srcLobData),
+		   lobHdfsServer, lobHdfsPort,
+                   outLobHandle, *outHandleLen,
+                   dummyParam, dummyParam,
+                   dummyParam,
+                   dummyParam, dummyParam,
+                   status,cliError,
+                   lobStorageLocation, ls, //Lob_HDFS_File,
+		   lobData, lobLen, 
 		   0,NULL,
-		   Lob_Insert,
-		   lso,
-                   1, 
+		   Lob_InsSel, 
+		   so,
+                   dummyParam,
 		   exLobGlob,
-		   0, NULL, 0
+		   xnId, 
+		   blackBox, blackBoxLen,
+		   lobMaxSize,
+		   lobMaxChunkMemSize,
+                   lobGCLimit,
+		   bufferSize,
+                   replication,
+                   blocksize
 		   );
-
-  if (err != LOB_OPER_OK)
+  if (err != LOB_OPER_OK) 
     return -err;
+    
 
+  
+  
   return 0;
 }
 
@@ -641,7 +658,7 @@ Lng32 ExpLOBInterfaceUpdateAppend(void * exLobGlob,
   Ex_Lob_Error status;
   Int64 cliError = -1;
   Int64 srcLen = 0;
-  if((so == Lob_Memory) || (so== Lob_External))
+  if((so == Lob_Memory) || (so== Lob_External_File))
     srcLen = strlen(srcLobData);
   else if (so == Lob_Buffer)
     srcLen = tgtLobLen;
@@ -711,7 +728,7 @@ Lng32 ExpLOBInterfaceUpdate(void * exLobGlob,
   Ex_Lob_Error status;
   Int64 cliError = -1;
   Int64 sourceLen = 0;
-  if((so == Lob_Memory) || (so == Lob_External))
+  if((so == Lob_Memory) || (so == Lob_External_File))
     sourceLen = strlen(srcLobData);
   else if (so == Lob_Buffer)
     sourceLen = tgtLobLen;
@@ -813,7 +830,7 @@ Lng32 ExpLOBInterfaceSelect(void * exLobGlob,
 			    Lng32 lobType,
 			    char * lobHdfsServer,
 			    Lng32 lobHdfsPort,
-
+                          
 			    Lng32 handleLen,
 			    char * lobHandle,
 			    Int64 &requestTag,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/exp/ExpLOBinterface.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBinterface.h b/core/sql/exp/ExpLOBinterface.h
index 1d5dbaf..a8245c8 100644
--- a/core/sql/exp/ExpLOBinterface.h
+++ b/core/sql/exp/ExpLOBinterface.h
@@ -111,22 +111,30 @@ Lng32 ExpLOBinterfaceCloseFile(void * lobGlob,
 			       Lng32 lobType,
 			       char * lobHdfsServer ,
 			       Lng32 lobHdfsPort );
-Lng32 ExpLOBInterfaceInsertSelect(void * lobGlob, 
-				  char * lobHdfsServer,
+Lng32 ExpLOBInterfaceInsertSelect(void * exLobGlob, 
+				  char * lobHdfsServer ,
 				  Lng32 lobHdfsPort ,
 				  char * tgtLobName,
+                                  LobsSubOper so,
 				  char * lobStorageLocation,
-				  Lng32 handleLen,
+                                  Int32 lobType,
+                                  Int64 xnId,
+				   Lng32 handleLen,
 				  char * lobHandle,
-				  Int64 &descSyskey,
-				  Int64 &lobLen,
-				  char * lobData, 
-				  char * srcLobName, 
-				  short srcDescSchNameLen,
-				  char * srcDescSchName,
-				  
-				  Int64 srcDescKey, 
-				  Int64 srcDescTS);
+                                  Int32 * outHandleLen,
+                                  char * outLobHandle,
+                                  char * lobData,
+                                  Int64 lobDataLen,
+                                  char *blackBox,
+                                  Int64 blackBoxLen,
+                                  Int64 lobMaxSize,
+                                  Int64 lobMaxChunkMemSize ,
+                                  Int64 lobGCLimit ,
+                                  int    bufferSize = 0,
+                                  short  replication =0,
+                                  int    blocksize=0
+
+                                  );
 Lng32 ExpLOBInterfaceInsert(void * lobGlob, 
 			    char * tgtLobName,
 			    char * lobLocation,
@@ -243,7 +251,7 @@ Lng32 ExpLOBInterfaceSelect(void * lobGlob,
 			    Lng32  lobType,
 			    char * lobHdfsServer,
 			    Lng32 lobHdfsPort,
-
+                           
 			    Lng32 handleLen,
 			    char * lobHandle,
 			    Int64 &requestTag,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/generator/GenItemFunc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenItemFunc.cpp b/core/sql/generator/GenItemFunc.cpp
index 6e98065..c73ba9e 100644
--- a/core/sql/generator/GenItemFunc.cpp
+++ b/core/sql/generator/GenItemFunc.cpp
@@ -2874,7 +2874,12 @@ short LOBinsert::codeGen(Generator * generator)
   else if (obj_ == LOBoper::LOAD_)
     li->setFromLoad(TRUE);
   else if (obj_ == LOBoper::LOB_)
-    li->setFromLob(TRUE);
+    {
+      if (lobStorageType() != Lob_External_HDFS_File)
+        li->setFromLob(TRUE);
+      else
+        li->setFromLobExternal(TRUE);
+    }
   else if (obj_ == LOBoper::EXTERNAL_)
     li->setFromExternal(TRUE);
   else if (obj_ ==LOBoper::BUFFER_)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/generator/GenPreCode.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenPreCode.cpp b/core/sql/generator/GenPreCode.cpp
index d96378d..cb0dbb6 100644
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@ -5526,7 +5526,7 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
       setInsertType(Insert::SIMPLE_INSERT);
 
       NAColumnArray colArray;
-      NAColumn *col;
+      NAColumn *tgtCol, *srcCol;
 
       for (CollIndex ii = 0;
            ii < newRecExprArray().entries(); ii++)
@@ -5540,8 +5540,8 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
 	  ValueId srcValueId =
 	    assignExpr->child(1)->castToItemExpr()->getValueId();
 
-	  col = tgtValueId.getNAColumn( TRUE );
-	  
+	  tgtCol = tgtValueId.getNAColumn( TRUE );
+	  srcCol = srcValueId.getNAColumn( TRUE );
 	  ItemExpr * child1Expr = assignExpr->child(1);
 	  if (srcValueId.getType().isLob())
 	    {
@@ -5570,18 +5570,36 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
                   li->lobSize() = tgtValueId.getType().getPrecision();
 		  li->lobFsType() = tgtValueId.getType().getFSDatatype();
 
-		  li->lobNum() = col->lobNum();
+		  li->lobNum() = tgtCol->lobNum();
                   if ((child1Expr->getOperatorType() == ITM_CONSTANT) && 
                       !(((ConstValue *)child1Expr)->isNull()))
-                    if (li->lobStorageType() != col->lobStorageType())
+                    {
+                    if (srcCol->lobStorageType() != tgtCol->lobStorageType())
                       {
                         *CmpCommon::diags() << DgSqlCode(-1432)
-                                            << DgInt0((Int32)li->lobStorageType())
-                                            << DgInt1((Int32)col->lobStorageType())
-                                            << DgString0(col->getColName());
+                                            << DgInt0((Int32)srcCol->lobStorageType())
+                                            << DgInt1((Int32)tgtCol->lobStorageType())
+                                            << DgString0(tgtCol->getColName());
                         GenExit();
                       }
-		  li->lobStorageLocation() = col->lobStorageLocation();
+                    }
+                    else
+                      if ((child1Expr->getOperatorType() == ITM_BASECOLUMN)||
+                          (child1Expr->getOperatorType() == ITM_INDEXCOLUMN))
+                        {
+                          if (srcCol->lobStorageType() != tgtCol->lobStorageType())
+                            {
+                              *CmpCommon::diags() << DgSqlCode(-1432)
+                                                  << DgInt0((Int32)srcCol->lobStorageType())
+                                                  << DgInt1((Int32)tgtCol->lobStorageType())
+                                                  << DgString0(tgtCol->getColName());
+                              GenExit();
+                            }
+                          
+                        }
+                  li->lobStorageType() = tgtCol->lobStorageType();
+
+		  li->lobStorageLocation() = tgtCol->lobStorageLocation();
 
 		  li->bindNode(generator->getBindWA());
 
@@ -5606,22 +5624,22 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
 			   getTableName().getSchemaName());
 		  li->insertedTableSchemaName() += "\"";
 		  
-		  li->lobNum() = col->lobNum();
+		  li->lobNum() = tgtCol->lobNum();
                   //If we are initializing an empty_lob, assume the storage 
                   //type of the underlying column
                   if (li->lobStorageType() == Lob_Empty)
                     {
-                      li->lobStorageType() = col->lobStorageType();
+                      li->lobStorageType() = tgtCol->lobStorageType();
                     }
-                  if (li->lobStorageType() != col->lobStorageType())
+                  if (li->lobStorageType() != tgtCol->lobStorageType())
                     {
                       *CmpCommon::diags() << DgSqlCode(-1432)
                                           << DgInt0((Int32)li->lobStorageType())
-                                          << DgInt1((Int32)col->lobStorageType())
-                                          << DgString0(col->getColName());
+                                          << DgInt1((Int32)tgtCol->lobStorageType())
+                                          << DgString0(tgtCol->getColName());
                         GenExit();
                       }
-		  li->lobStorageLocation() = col->lobStorageLocation();
+		  li->lobStorageLocation() = tgtCol->lobStorageLocation();
 		  
 		  li->lobSize() = tgtValueId.getType().getPrecision();
 
@@ -5651,9 +5669,9 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
                       li->lobSize() = tgtValueId.getType().getPrecision();
 		      li->lobFsType() = tgtValueId.getType().getFSDatatype();
 
-		      li->lobNum() = col->lobNum();
+		      li->lobNum() = tgtCol->lobNum();
 		     
-		      li->lobStorageLocation() = col->lobStorageLocation();
+		      li->lobStorageLocation() = tgtCol->lobStorageLocation();
 		      
 		      li->bindNode(generator->getBindWA());
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b8cfdc87/core/sql/optimizer/ItemFunc.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ItemFunc.h b/core/sql/optimizer/ItemFunc.h
index 388c81e..702d5b4 100644
--- a/core/sql/optimizer/ItemFunc.h
+++ b/core/sql/optimizer/ItemFunc.h
@@ -2875,7 +2875,7 @@ public:
      hdfsPort_((Lng32)CmpCommon::getDefaultNumeric(LOB_HDFS_PORT)),
      hdfsServer_( CmpCommon::getDefaultString(LOB_HDFS_SERVER))
    {
-     if ((obj == STRING_) || (obj == BUFFER_) || (obj == FILE_) )
+     if ((obj == STRING_) || (obj == BUFFER_) || (obj == FILE_) || (obj ==LOB_) )
        lobStorageType_ = Lob_HDFS_File;
      else if (obj == EXTERNAL_)
        lobStorageType_ = Lob_External_HDFS_File;



[6/7] incubator-trafodion git commit: Fixed review comments

Posted by sa...@apache.org.
Fixed review comments


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

Branch: refs/heads/master
Commit: 53e103c0b1c542ee057a7857d431f03915a17f40
Parents: fe262aa
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Fri Apr 28 18:07:35 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Fri Apr 28 18:07:35 2017 +0000

----------------------------------------------------------------------
 core/sql/common/ComSmallDefs.h |  1 +
 core/sql/exp/ExpLOB.cpp        | 38 ++++++++++++++++++-------------------
 core/sql/exp/ExpLOB.h          |  9 ++++-----
 core/sql/exp/ExpLOBaccess.cpp  |  8 ++++----
 core/sql/exp/ExpLOBaccess.h    | 13 ++-----------
 core/sql/exp/ExpLOBenums.h     | 12 ++++++++++++
 6 files changed, 42 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index f930f55..c3803e5 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -53,6 +53,7 @@ using namespace std;
 #include "NAString.h"
 #include "Int64.h"
 #include "dfs2rec.h"
+
 #ifndef NULL
 #define NULL 0
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOB.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.cpp b/core/sql/exp/ExpLOB.cpp
index 28cd1c1..7184fb4 100644
--- a/core/sql/exp/ExpLOB.cpp
+++ b/core/sql/exp/ExpLOB.cpp
@@ -155,9 +155,9 @@ Lng32 ExpLOBoper::createLOB(void * exLobGlob, void *currContext, void * lobHeap,
 			    char * lobLoc,Int32 hdfsPort,char *hdfsServer,
 			    Int64 uid, Lng32 num, Int64 lobMaxSize )
 {
-  char buf[100];
+  char buf[LOB_NAME_LEN];
   
-  char * lobName = ExpGetLOBname(uid, num, buf, 100);
+  char * lobName = ExpGetLOBname(uid, num, buf, LOB_NAME_LEN);
   if (lobName == NULL)
     return -1;
 
@@ -279,9 +279,9 @@ Lng32 ExpLOBoper::dropLOB(void * exLobGlob, void * lobHeap, void *currContext,
 			  char * lobLoc,Int32 hdfsPort, char *hdfsServer,
 			  Int64 uid, Lng32 num)
 {
-  char buf[101];
+  char buf[LOB_NAME_LEN];
   
-  char * lobName = ExpGetLOBname(uid, num, buf, 100);
+  char * lobName = ExpGetLOBname(uid, num, buf, LOB_NAME_LEN);
   if (lobName == NULL)
     return -1;
 
@@ -307,9 +307,9 @@ Lng32 ExpLOBoper::purgedataLOB(void * exLobGlob, char * lobLoc,
                                
 			       Int64 uid, Lng32 num)
 {
-  char buf[100];
+  char buf[LOB_NAME_LEN];
   
-  char * lobName = ExpGetLOBname(uid, num, buf, 100);
+  char * lobName = ExpGetLOBname(uid, num, buf, LOB_NAME_LEN);
   if (lobName == NULL)
     return -1;
 
@@ -706,8 +706,8 @@ ex_expr::exp_return_type ExpLOBiud::insertDesc(char *op_data[],
 		      (ExeErrorCode)(8434));
       return ex_expr::EXPR_ERROR;
     }
-  char tgtLobNameBuf[100];
-  char * tgtLobName = ExpGetLOBname(objectUID_, lobNum(), tgtLobNameBuf, 100);
+  char tgtLobNameBuf[LOB_NAME_LEN];
+  char * tgtLobName = ExpGetLOBname(objectUID_, lobNum(), tgtLobNameBuf, LOB_NAME_LEN);
 
   if (tgtLobName == NULL)
     return ex_expr::EXPR_ERROR;
@@ -929,8 +929,8 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
 		       handle);
   
    // get the lob name where data need to be inserted
-  char tgtLobNameBuf[100];
-  char * tgtLobName = ExpGetLOBname(uid, lobNum, tgtLobNameBuf, 100);
+  char tgtLobNameBuf[LOB_NAME_LEN];
+  char * tgtLobName = ExpGetLOBname(uid, lobNum, tgtLobNameBuf, LOB_NAME_LEN);
 
   if (tgtLobName == NULL)
     return ex_expr::EXPR_ERROR;
@@ -1112,8 +1112,8 @@ ex_expr::exp_return_type ExpLOBdelete::eval(char *op_data[],
   Lng32 handleLen = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]);
 
   // get the lob name where data need to be deleted
-  char lobNameBuf[100];
-  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, 100);
+  char lobNameBuf[LOB_NAME_LEN];
+  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, LOB_NAME_LEN);
   if (lobName == NULL)
     return ex_expr::EXPR_ERROR;
 
@@ -1294,18 +1294,18 @@ ex_expr::exp_return_type ExpLOBupdate::eval(char *op_data[],
 
   
   // get the lob name where data need to be updated
-  char tgtLobNameBuf[100];
-  char * tgtLobName = ExpGetLOBname(sUid, sLobNum, tgtLobNameBuf, 100);
+  char tgtLobNameBuf[LOB_NAME_LEN];
+  char * tgtLobName = ExpGetLOBname(sUid, sLobNum, tgtLobNameBuf, LOB_NAME_LEN);
 
   if (tgtLobName == NULL)
     return ex_expr::EXPR_ERROR;
 
-  char fromLobNameBuf[100];
+  char fromLobNameBuf[LOB_NAME_LEN];
   char * fromLobName = NULL;
   Int64 fromDescKey = 0;
   Int64 fromDescTS = 0;
   short fromSchNameLen = 0;
-  char  fromSchName[500];
+  char  fromSchName[ComAnsiNamePart::MAX_IDENTIFIER_EXT_LEN+1];
   if (0) // TBD. fromLob())
     {
       Lng32 fromLobType;
@@ -1318,7 +1318,7 @@ ex_expr::exp_return_type ExpLOBupdate::eval(char *op_data[],
 			   op_data[1]);
 
       // get the lob name where data will be read from
-      fromLobName = ExpGetLOBname(fromLobUid, fromLobNum, fromLobNameBuf, 100);
+      fromLobName = ExpGetLOBname(fromLobUid, fromLobNum, fromLobNameBuf, LOB_NAME_LEN);
       if (fromLobName == NULL)
 	return ex_expr::EXPR_ERROR;
     }
@@ -1563,8 +1563,8 @@ ex_expr::exp_return_type ExpLOBconvert::eval(char *op_data[],
 			   &schNameLen, schName,
 			   lobHandle);
   // get the lob name where data need to be inserted
-  char lobNameBuf[100];
-  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, 100);
+  char lobNameBuf[LOB_NAME_LEN];
+  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, LOB_NAME_LEN);
       
   if (descKey == -1) //This is an empty_blob/clob
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOB.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.h b/core/sql/exp/ExpLOB.h
index 66f213c..0d2561d 100644
--- a/core/sql/exp/ExpLOB.h
+++ b/core/sql/exp/ExpLOB.h
@@ -45,7 +45,6 @@
 #include "exp_clause.h"
 #include "ExpLOBenums.h"
 
-#define LOB_HANDLE_LEN 1024
 
 class ExLobInMemoryDescChunksEntry;
 ////////////////////////////////
@@ -384,16 +383,16 @@ protected:
   char outLobHandle_[LOB_HANDLE_LEN];
   Int32 outHandleLen_;
 
-  char blackBox_[1024];
+  char blackBox_[MAX_BLACK_BOX_LEN];
   Int64 blackBoxLen_;
 
-  char lobStorageLocation_[1024];
+  char lobStorageLocation_[MAX_LOB_FILE_NAME_LEN];
 
-  char lobHdfsServer_[512];
+  char lobHdfsServer_[256];
   Lng32 lobHdfsPort_;
 
   short descSchNameLen_;
-  char  descSchName_[510];
+  char  descSchName_[ComAnsiNamePart::MAX_IDENTIFIER_EXT_LEN+1];
   Int64 lobSize_;
   Int64 lobMaxSize_;
   Int64 lobMaxChunkMemSize_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index 7ea3da5..27d8c5f 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -2569,16 +2569,16 @@ Ex_Lob_Error ExLobsOper (
         Int32 lobType;
         Int64 uid, inDescSyskey, descPartnKey;
         short schNameLen;
-        char schName[1024];
-        char sourceHandle[512]  = {};
+        char schName[ComAnsiNamePart::MAX_IDENTIFIER_EXT_LEN+1];
+        char sourceHandle[LOB_HANDLE_LEN]  = {};
         str_cpy_all(sourceHandle, source, sourceLen);
         ExpLOBoper::extractFromLOBhandle(&flags, &lobType, &lobNum, &uid,  
                                    &inDescSyskey, &descPartnKey,
                                    &schNameLen, schName,
                                    sourceHandle); 
-        char srcLobNameBuf[100];
+        char srcLobNameBuf[LOB_NAME_LEN];
         char * srcLobName = 
-          ExpLOBoper::ExpGetLOBname(uid, lobNum, srcLobNameBuf, 100);
+          ExpLOBoper::ExpGetLOBname(uid, lobNum, srcLobNameBuf, LOB_NAME_LEN);
         lobMap_it it2;
         it2 = lobMap->find(string(srcLobName));
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOBaccess.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.h b/core/sql/exp/ExpLOBaccess.h
index 7d97e19..acb63fc 100644
--- a/core/sql/exp/ExpLOBaccess.h
+++ b/core/sql/exp/ExpLOBaccess.h
@@ -67,15 +67,6 @@
 using namespace std;
 
 
-#define MAX_LOB_FILE_NAME_LEN 256
-#define MAX_HANDLE_IN_LEN 1024
-#define MAX_HANDLE_OUT_LEN 1024
-#define MAX_BLACK_BOX_LEN 2048
-#define LOB_DESC_HEADER_KEY 1
-#define NUM_WORKER_THREADS 2 
-// 2 threads at most, one to read and the other to pick up next read from preOpen
-
-#define LOB_CURSOR_PREFETCH_BYTES_MAX (1 << 27) // 128MB
 
 class ExLobGlobals;
 // This class defines the request used to construct the message to send over 
@@ -133,9 +124,9 @@ class ExLobRequest
     Int64 reqNum_;
     Int64 descNumIn_;
     Int64 descNumOut_;
-    char handleIn_[MAX_HANDLE_IN_LEN];
+    char handleIn_[LOB_HANDLE_LEN];
     Int64 handleInLen_;
-    char handleOut_[MAX_HANDLE_OUT_LEN];
+    char handleOut_[LOB_HANDLE_LEN];
     Int64 handleOutLen_;
     Int64 dataOffset_;
     LobsRequest type_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOBenums.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBenums.h b/core/sql/exp/ExpLOBenums.h
index d63a0e2..37af1d0 100644
--- a/core/sql/exp/ExpLOBenums.h
+++ b/core/sql/exp/ExpLOBenums.h
@@ -24,7 +24,19 @@
 #define EXP_LOB_ENUMS_H
 
 #include "ComSmallDefs.h"
+#include "ComAnsiNamePart.h"
+#define LOB_HANDLE_LEN 1024
+#define LOB_NAME_LEN 50 // LOBP_<objectUid>_<LOBnum>  
+                         //      <---20----> <--4--->Need 30 bytes -  allocating extra.
+#define MAX_LOB_FILE_NAME_LEN 256
+#define MAX_BLACK_BOX_LEN 2048
+#define LOB_DESC_HEADER_KEY 1
+#define NUM_WORKER_THREADS 2
 
+ 
+// 2 threads at most, one to read and the other to pick up next read from preOpen
+
+#define LOB_CURSOR_PREFETCH_BYTES_MAX (1 << 27) // 128MB
 // IMPORTANT //
 // If an enum is added here, make sure that a corresponding entry is
 // made in lobErrorEnumStr that follows this enum list.