[GitHub] incubator-trafodion pull request #1229: [TRAFODION-2734] Create *Trafodion L...

2017-09-17 Thread sandhyasun
Github user sandhyasun commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139335792
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB()   

[GitHub] incubator-trafodion pull request #1229: [TRAFODION-2734] Create *Trafodion L...

2017-09-17 Thread sandhyasun
Github user sandhyasun commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139335610
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB()   

[GitHub] incubator-trafodion pull request #1236: TRAFODION-2731 CodeCleanup: Phase 2:...

2017-09-17 Thread anoopsharma00
GitHub user anoopsharma00 opened a pull request:

https://github.com/apache/incubator-trafodion/pull/1236

TRAFODION-2731 CodeCleanup: Phase 2: Remove obsolete code

This phase handles the following:

-- removed files:
  cli/rtdu.h, rtdu2.h, rtdu.cpp, rtdu.cpp
  executor/dmeasql.h
  executor/ExMeas.h, ExMeas.cpp
  executor/tempfile.h, .cpp
  executor/rcb.h
  executor/stubs.cpp, stubs2.cpp
  exp/srlversion.cpp
  exp/exp_space.h
  cli/VicKeyValuePair.h
  cli/CliDll.cpp
  cli/CliStubsStaticBuild.cpp
  cli/globalsrlversion.cpp
  cli/globalstubs.cpp
  cli/sqlciSRLStubs.cpp
  cli/test.cpp
  cli/privsrlversion.cpp
  common/SqlExpDllDefines.h
  common/SqlExportDllDefines.h
  sqlcat/enum.h
  sqlcat/ReadTableDef.h, cpp
  sqlcat/readRealArk.h, cpp
  sqlshare/catapirequest.*

-- removed defines and code referencing them:
  -- NA_STD_NAMESPACE
  -- NA_NO_CMPCONTEXT
  -- NA_CATMAN_SIM, NA_CATMAN_SIM_FS
  -- common/purify.h
  -- DONT_USE_MATH_H
  -- NT_PORT
  -- NA_MSVC
  -- NA_NO_FRIENDS_WITH_TEMPLATE_REFS
  -- NA_FLEXBUILD
  -- NA_LINUX_SETENV

-- removed multiple obsolete sqlci features and syntax:
   (report writer, MACL, Help, Simulators, Utils, MXCS mode, Help,
and few others).

-- removed following files in sqlci dir:
   CSInterface.h
   CharSetConstants.cpp
   CharSetConstants.h
   MsgCat.cpp
   MsgCat.h
   MxciEHCallBack.cpp
   MxciEHCallBack.h
   RWInterface.cpp
   RWInterface.h
   SqlciCSCmd.cpp
   SqlciCSCmd.h
   SqlciCSSimulator.cpp
   SqlciHelp.cpp
   SqlciRWCmd.cpp
   SqlciRWCmd.h
   SqlciRWSimulator.cpp
   SqlciUsage.cpp
   SqlciUtil.cpp
   SqlciUtil.h
   UtilInt.cpp
   UtilInt.h
   UtilMsg.cpp
   UtilMsg.h
   immudefs.cpp
   immudefs.h

-- removed references to NT_PORT


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/anoopsharma00/incubator-trafodion 
ansharma_t23cleanup_br

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafodion/pull/1236.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1236


commit b952c0d5f96f773155467249631622a79e0ca68e
Author: Anoop Sharma 
Date:   2017-09-15T00:13:37Z

code cleanup, commit #1

commit 331fbd2aca3ac8938a8f6ead3c4b02687e562ee0
Author: Anoop Sharma 
Date:   2017-09-17T20:15:18Z

Merge remote branch 'origin/master' into ansharma_t23cleanup_br

commit 62b45310c224be5c2e83de0ca5afbd7ad283166b
Author: Anoop Sharma 
Date:   2017-09-17T23:09:11Z

TRAFODION-2731 CodeCleanup: Phase 2: Remove obsolete code

This phase handles the following:

-- removed files:
  cli/rtdu.h, rtdu2.h, rtdu.cpp, rtdu.cpp
  executor/dmeasql.h
  executor/ExMeas.h, ExMeas.cpp
  executor/tempfile.h, .cpp
  executor/rcb.h
  executor/stubs.cpp, stubs2.cpp
  exp/srlversion.cpp
  exp/exp_space.h
  cli/VicKeyValuePair.h
  cli/CliDll.cpp
  cli/CliStubsStaticBuild.cpp
  cli/globalsrlversion.cpp
  cli/globalstubs.cpp
  cli/sqlciSRLStubs.cpp
  cli/test.cpp
  cli/privsrlversion.cpp
  common/SqlExpDllDefines.h
  common/SqlExportDllDefines.h
  sqlcat/enum.h
  sqlcat/ReadTableDef.h, cpp
  sqlcat/readRealArk.h, cpp
  sqlshare/catapirequest.*

-- removed defines and code referencing them:
  -- NA_STD_NAMESPACE
  -- NA_NO_CMPCONTEXT
  -- NA_CATMAN_SIM, NA_CATMAN_SIM_FS
  -- common/purify.h
  -- DONT_USE_MATH_H
  -- NT_PORT
  -- NA_MSVC
  -- NA_NO_FRIENDS_WITH_TEMPLATE_REFS
  -- NA_FLEXBUILD

-- removed multiple obsolete sqlci features and syntax:
   (report writer, MACL, Help, Simulators, Utils, MXCS mode, Help,
and few others).

-- removed following files in sqlci dir:
   CSInterface.h
   CharSetConstants.cpp
   CharSetConstants.h
   MsgCat.cpp
   MsgCat.h
   MxciEHCallBack.cpp
   MxciEHCallBack.h
   RWInterface.cpp
   RWInterface.h
   SqlciCSCmd.cpp
   SqlciCSCmd.h
   SqlciCSSimulator.cpp
   SqlciHelp.cpp
   SqlciRWCmd.cpp
   SqlciRWCmd.h
   SqlciRWSimulator.cpp
   SqlciUsage.cpp
   SqlciUtil.cpp
   SqlciUtil.h
   UtilInt.cpp
   UtilInt.h
   UtilMsg.cpp
   UtilMsg.h
   immudefs.cpp
   immudefs.h




---


[GitHub] incubator-trafodion pull request #1220: [TRAFODION-2725] SQL types are REAL,...

2017-09-17 Thread SuJinpei
Github user SuJinpei commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1220#discussion_r139306445
  
--- Diff: win-odbc64/odbcclient/drvr35/drvrglobal.cpp ---
@@ -865,77 +865,18 @@ bool use_gcvt(double number, char* string, short size)
 
 bool double_to_char (double number, int precision, char* string, short 
size)
 {
-   char *buffer,*temp ;
-   bool rc = true;
-
-   int decimal_spot,
-   sign,
-   count,
-   current_location = 0,
-   length;
-
-   *string = 0;
-
-   temp = _fcvt (number, precision, _spot, ) ;
-   length = strlen(temp);
-   if (length == 0)
-   {
-   return use_gcvt(number,string,size);
-   }
-   if (length > precision)
-   buffer = (char *) malloc (length + 3) ;
-   else
-   buffer = (char *) malloc (precision + 3) ;
-
-   if (buffer == NULL)
-   return false;
-
-/* Add negative sign if required. */ 
-
-   if (sign)
-   buffer [current_location++] = '-' ;
-
-/* Place decimal point in the correct location. */ 
-
-   if (decimal_spot > 0)
-   {
-   strncpy ( [current_location], temp, decimal_spot) ;
-   buffer [decimal_spot + current_location] = '.' ;
-   strcpy ( [decimal_spot + current_location + 1],
-[decimal_spot]) ;
-   }
-   else
-   {
-   buffer [current_location] = '.' ;
-   for(count = current_location;
-   count< abs(decimal_spot)+current_location; count++)
-   buffer [count + 1] = '0' ;
-   strcpy ( [count + 1], temp) ;
-   }
+bool rc = false;
+char format[16];
+char buf[MAX_DOUBLE_TO_CHAR_LEN];
 
-   rSup(buffer);
-   length = strlen(buffer);
-   if (buffer[0] == '.' || (buffer[0] == '-' && buffer[1] == '.')) 
length++;
+sprintf(format, "%%.%dlg", precision);
+sprintf(buf, format, number);
--- End diff --

@selvaganesang from original code logic, size should larger than 
strlen(buf).  if we still want to return reasonable value though size less than 
strlen(buf), I think we should use other algorithm instead of snprintf.


---


[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139303434
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139303423
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139303401
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139303398
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139303375
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139302835
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139302837
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139302827
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139302735
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB() 

[GitHub] incubator-trafodion pull request #1229: [Trafodion-2734] Create *Trafodion L...

2017-09-17 Thread liuyu000
Github user liuyu000 commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1229#discussion_r139302665
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/work_with_lob.adoc ---
@@ -0,0 +1,738 @@
+
+/**
+* @@@ START COPYRIGHT @@@
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+*   http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*
+* @@@ END COPYRIGHT @@@
+*/
+
+
+[#work with lob]
+= Work with LOB
+
+[#create a sql table with lob columns]
+== Create a SQL Table with LOB Columns
+
+When creating a SQL table with LOB columns, following relevant tables and 
files are created as well:
+
+* One LOB MD table.
+* Two dependent descriptor tables.
+* HDFS data file (locates at /user/trafodion/lobs) for each column.
+
+[#syntax]
+== Syntax
+
+```
+CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…)
+```
+
+```
+lob-column-spec is:
+column {lob type}
+
+lob type is:
+BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
+
+unit is:
+empty | 
+K | 
+M | 
+G 
+```
+
+[#semantics]
+=== Semantics
+
+* `_storage literal_`
+
++
+Currently Trafodion only support `'EXTERNAL'` here. 
+
++
+External LOB object that are not managed by Trafodion.
+
+* `_empty_`
+
++
+Number of bytes specified by the numeric literal.
+
+* `_K_`
+
++
+Numeric literal value * 1024.
+
+* `_M_`
+
++
+Numeric literal value * 1024 * 1024.
+
+* `_G_`
+
++
+Numeric literal value * 1024 * 1024 * 1024.
+
+[#examples]
+=== Examples
+
+* This example creates a table tlob1 with 2 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob1 (c1 INT NOT NULL, c2 BLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob2 with 3 columns and primary key on the 
c1.
+
++
+
+```
+CREATE TABLE tlob2 (c1 INT NOT NULL, c2 BLOB, c3 CLOB, PRIMARY KEY (c1));
+```
+
+* This example creates a table tlob130txt_limit50 with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130txt_limit50 (c1 INT NOT NULL, c2 CLOB(50), PRIMARY KEY 
(c1));
+```
+
+* This example creates a table tlob130bin_limit1K with 2 columns and 
primary key on the c1.
+
++
+
+```
+CREATE TABLE tlob130bin_limit1K (c1 INT NOT NULL, c2 BLOB(1 K), PRIMARY 
KEY (c1));
+```
+
+* This example creates a table tlob130ext with 4 columns and primary key 
on the c1.
+
++
+
+```
+CREATE TABLE tlob130ext (c1 INT NOT NULL, c2 BLOB, c3 CLOB, c4 BLOB 
STORAGE 'EXTERNAL', PRIMARY KEY (c1));
+```
+
+[#hdfs location of lob data]
+=== HDFS Location of LOB Data
+
+When a LOB table is created, the underlying LOB data needs to be stored in 
HDFS.It is in the /user/trafodion/lobs by default. 
+
+All columns of a table that are declared as LOB types will have all their 
data in one file derived from the Object UID and the LOB number of that column 
which gets assigned during creation.
+
+The following is a LOB file with 2 columns you will see 2 files in HDFS:
+
+/user/trafodion/lobs /LOBP_03683514167332904796_0001
+
+/user/trafodion/lobs/LOBP_03683514167332904796_0002
+
+As rows are added to this column, the LOB data for each row gets appended 
to the corresponding column’s LOB data file. 
+
+[#insert into a sql table containing lob columns]
+== Insert into a SQL Table Containing LOB Columns
+
+[#syntax]
+=== Syntax
+
+```
+INSERT INTO table-name [(target-col-list)] insert-source
+```
+
+```
+target-col-list is: 
+colname[, colname]... 
+
+insert-source is: 
+VALUES(lob_query-expr[, lob_query-expr])
+
+lob_query-expr is: 
+NULL | ?   
  |
+EMPTY_BLOB()