[GitHub] incubator-trafodion pull request #1356: [TRAFODION-2855] Correct the syntax ...

2017-12-20 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1356#discussion_r158144904
  
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_utilities.adoc ---
@@ -443,24 +443,39 @@ specify one or more of these options:
 
 ** `CONTINUE ON ERROR`
 +
-LOAD statement will continue after errors encountered while scanning rows 
from source table. 
+LOAD statement will continue after ignorable errors while scanning rows 
from source table or loading into the target table. The ignorable errors are 
usually data conversion errors.
 +
 Errors during the load or sort phase will cause the LOAD statement to 
abort. 
 +
-Error rows will be logged by default in HDFS files in the directory 
`/user/trafodion/bulkload/logs`. The default name of the error files will be of 
the form `ERR___`, where `` is a 
numeric identifier unique to the process where the error was seen.
-+
-This option is implied if `LOG ERROR ROWS [TO _error-location-name_]` or 
`STOP AFTER _num_ ERROR ROWS` is specified and it is not enabled by default.
+This option is implied if `LOG ERROR ROWS [TO _error-location-name_]` or 
`STOP AFTER _num_ ERROR ROWS` is specified.
 
 ** `LOG ERROR ROWS [TO _error-location-name_]`
+*** Error rows
 +
 If error rows must be written to a specified location, then specify TO 
_error-location-name_, otherwise they will be written to the default location.
+`_error-location-name_` must be a HDFS directory name to which trafodion 
has write access.
 +
-Error logs are written in separate files by the processes involved in the 
load command under sub-directory representing the load command in the given 
location.
-The actual log file location is displayed in the load command output.
+Error rows will be logged in HDFS files in the *directory* 
`/user/trafodion/bulkload/logs` if the error log location is not specified. 
++
+The default name of the *subdirectory* is 
`_ERR_catalog.schema.target_table_date_id_`, where `_id_` is a numeric 
identifier timestamp (MMDD_HHMMSS) unique to the process where the error 
was seen.
++
+The default name of the *error file* is 
`_loggingFileNamePrefix_catalog.schema.target_table_instanceID_`, where 
`_loggingFileNamePrefix_` is hive_scan_err or traf_upsert_err depending on the 
data source table, and `_instanceID_` is the ID of instance starting from 0, 
generally there is only one instance.
--- End diff --

Suggest "...is the instance ID starting from 0, ..."


---


[GitHub] incubator-trafodion pull request #1358: [TRAFODION-2856] Add optimizer/UdrEr...

2017-12-20 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2856] Add optimizer/UdrErrors.h to analyzeMessageGuide.py

This allows the script to search for references to certain messages using 
these enums as well as the numbers themselves.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2856

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

https://github.com/apache/incubator-trafodion/pull/1358.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 #1358


commit 38dc10cbc608f56e474e1e83e35b25e08854fa4a
Author: Dave Birdsall <dbirdsall@...>
Date:   2017-12-20T21:33:45Z

[TRAFODION-2856] Add optimizer/UdrErrors.h to analyzeMessageGuide.py




---


[GitHub] incubator-trafodion pull request #1357: [TRAFODION-2852] Bring Messages Guid...

2017-12-20 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2852] Bring Messages Guide up-to-date for msgs 1200-1299 +others

This set of changes brings most of the messages in the range 1200-1299 in 
the Messages Guide up-to-date. Several obsolete messages were removed, and 
previously-undocumented messages were added. A few minor code changes were made 
removing dead code.


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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2852

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

https://github.com/apache/incubator-trafodion/pull/1357.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 #1357


commit 1304c577a0ba9e5e6a61c5552ee5e26186f2c3dd
Author: Dave Birdsall <dbirdsall@...>
Date:   2017-12-20T21:01:42Z

[TRAFODION-2852] Bring Messages Guide up-to-date for msgs 1200-1299 + others




---


[GitHub] incubator-trafodion pull request #1354: [TRAFODION-2850] Add a Note for EMPT...

2017-12-20 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1354#discussion_r158074973
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/working_with_lob.adoc ---
@@ -235,6 +235,8 @@ The source for inserting into a LOB can be any of the 
following:
 An unnamed parameter can be used to prepare a statement and then during an 
execution, either a function or a simple string parameter can be passed in 
which will be converted to LOB data.
 
 * `EMPTY_BLOB()` or `EMPTY_CLOB()` 
++
+NOTE: If you want to insert `EMPTY_BLOB()` or `EMPTY_CLOB()` into a lob 
column, the CQD `TRAF_CLOB_AS_VARCHAR` which is *ON* by default must be turned 
*OFF* before creating the table.
--- End diff --

And yes, your suggested comment looks right to me.


---


[GitHub] incubator-trafodion pull request #1354: [TRAFODION-2850] Add a Note for EMPT...

2017-12-19 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1354#discussion_r157883840
  
--- Diff: docs/lob_guide/src/asciidoc/_chapters/working_with_lob.adoc ---
@@ -235,6 +235,8 @@ The source for inserting into a LOB can be any of the 
following:
 An unnamed parameter can be used to prepare a statement and then during an 
execution, either a function or a simple string parameter can be passed in 
which will be converted to LOB data.
 
 * `EMPTY_BLOB()` or `EMPTY_CLOB()` 
++
+NOTE: If you want to insert `EMPTY_BLOB()` or `EMPTY_CLOB()` into a lob 
column, the CQD `TRAF_CLOB_AS_VARCHAR` which is *ON* by default must be turned 
*OFF* before creating the table.
--- End diff --

You may want to elaborate: The CQD must be 'ON' at the time the table with 
the BLOB / CLOB column is created. (Otherwise the table is created with a 
VARCHAR.)


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157639136
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc ---
@@ -367,6 +369,9 @@ SECOND 0-59 +
 FRACTION(n) 0-99 +
 in which n is the number of significant digits (default is 6; minimum is 
1; maximum is 6); +
 stored in 2, 4, or 8 bytes depending on number of digits^2^
+.2+| LOB Data Types .2+| LOB | BLOB | Binary Large Object .2+| 10G – no 
limit + 
+Currently it sets to 10G (default) and it’s controlled by the `CQD 
LOB_MAX_SIZE`, the size can be changed depending on your needs.
--- End diff --

Possible word smith: "Currently the limit defaults to 10Gb. This limit can 
be configured as needed using 'CQD LOB_MAX_SIZE'.


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638744
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3638,6 +3776,52 @@ The example displays only part of the result table 
of the EXPLAIN
 function. It first uses the EXPLAIN function to generate the table and
 then selects the desired columns.
 
+<<<
+[[externaltolob_function]]
+== EXTERNALTOLOB Function
+
+[[externaltolob_function_syntax]]
+=== Syntax Descriptions of EXTERNALTOLOB Function
+
+The EXTERNALTOLOB function converts data from an external file into LOB 
format. This function can be used in INSERT or UPDATE statement.  
--- End diff --

"an INSERT or UPDATE statement" or "INSERT or UPDATE statements" sounds a 
bit better


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157637308
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -213,6 +213,24 @@ corresponding week of the year.
 
 See the individual entry for the function.
 
+[[lob_functions]]
+== LOB Functions
+
+Trafodion provides following LOB functions to process LOB data.
+
+[cols="25%,75%"]
+|===
+| <<emptyblob_function,EMPTY_BLOB() Function>>   | Creates a dummy LOB 
handle with BLOB.
+| <<emptyclob_function,EMPTY_CLOB() Function>>   | Creates a dummy LOB 
handle with CLOB.
--- End diff --

Similarly


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638376
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3405,6 +3461,88 @@ DIFF2_I1TS
 --- 5 row(s) selected.
 ```
 
+<<<
+[[emptyblob_function]]
+== EMPTY_BLOB() Function
+
+[[syntax_descriptions_of_emptyblob_function]]
+=== Syntax Descriptions of EMPTY_BLOB() Function
+
+The EMPTY_BLOB() function creates a dummy LOB handle with BLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
+
+EMPTY_BLOB() function is a Trafodion SQL extension.
+
+For more information, see 
http://trafodion.incubator.apache.org/docs/lob_guide/index.html[Trafodion SQL 
Large Objects Guide].
+
+```
+EMPTY_BLOB()
+```
+
+[[considerations_for_emptyblob_function]]
+=== Considerations for EMPTY_BLOB() Function
+
+* If EMPTY_BLOB() is specified, then a dummy lob handle is created.
+
+** No data is associated with the empty LOBs yet, but these dummy LOB 
handles can later be used to populate with new LOB data. If the LOB had data 
previously associated with it, it will be erased.
--- End diff --

I would say, "...can later be used to populate the LOB with new data. ..."


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638640
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3405,6 +3461,88 @@ DIFF2_I1TS
 --- 5 row(s) selected.
 ```
 
+<<<
+[[emptyblob_function]]
+== EMPTY_BLOB() Function
+
+[[syntax_descriptions_of_emptyblob_function]]
+=== Syntax Descriptions of EMPTY_BLOB() Function
+
+The EMPTY_BLOB() function creates a dummy LOB handle with BLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
+
+EMPTY_BLOB() function is a Trafodion SQL extension.
+
+For more information, see 
http://trafodion.incubator.apache.org/docs/lob_guide/index.html[Trafodion SQL 
Large Objects Guide].
+
+```
+EMPTY_BLOB()
+```
+
+[[considerations_for_emptyblob_function]]
+=== Considerations for EMPTY_BLOB() Function
+
+* If EMPTY_BLOB() is specified, then a dummy lob handle is created.
+
+** No data is associated with the empty LOBs yet, but these dummy LOB 
handles can later be used to populate with new LOB data. If the LOB had data 
previously associated with it, it will be erased.
+
+** The dummy LOB handle will get the same datatype as the underlying 
column.
++
+For example, if the LOB column was defined as `‘EXTERNAL’` during 
table creation, then the LOB column gets that type. If it’s not defined, then 
it is considered as a regular LOB. 
+
+* An empty LOB is distinct from a LOB containing a string of length zero 
or a null LOB.
+
+[[examples_of_emptyblob_function]]
+=== Examples of EMPTY_BLOB() Function
+
+* This example uses the EMPTY_BLOB to insert an empty LOB and creates a 
dummy LOB handle. 
++
+```
+insert into test1 values (1, empty_blob());
+```
+
+<<<
+[[emptyclob_function]]
+== EMPTY_CLOB() Function
+
+[[syntax_descriptions_of_emptyclob_function]]
+=== Syntax Descriptions of EMPTY_CLOB() Function
+
+The EMPTY_CLOB() function creates a dummy LOB handle with CLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
+
+EMPTY_CLOB() function is a Trafodion SQL extension.
+
+For more information, see 
http://trafodion.incubator.apache.org/docs/lob_guide/index.html[Trafodion LOB 
Guide].
+
+```
+EMPTY_CLOB()
+```
+
+[[considerations_for_emptyclob_function]]
+=== Considerations for EMPTY_CLOB() Function
+
+* If EMPTY_CLOB() is specified, then a dummy lob handle is created.
+
+** No data is associated with the empty LOBs yet, but these dummy LOB 
handles can later be used to populate with new LOB data. If the LOB had data 
previously associated with it, it will be erased.
--- End diff --

Similar to previous comment


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638951
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -7182,6 +7404,40 @@ SELECT STDDEV (price * qty_available) FROM 
sales.parts;
 --- 1 row(s) selected.
 ```
 
+<<<
+[[stringtolob_function]]
+== STRINGTOLOB Function
+
+[[stringtolob_function_syntax]]
+=== Syntax Descriptions of STRINGTOLOB Function
+
+The STRINGTOLOB function converts a simple string literal into LOB format. 
This function can be used in INSERT or UPDATE statement.
--- End diff --

same comment as before


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638612
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3405,6 +3461,88 @@ DIFF2_I1TS
 --- 5 row(s) selected.
 ```
 
+<<<
+[[emptyblob_function]]
+== EMPTY_BLOB() Function
+
+[[syntax_descriptions_of_emptyblob_function]]
+=== Syntax Descriptions of EMPTY_BLOB() Function
+
+The EMPTY_BLOB() function creates a dummy LOB handle with BLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
+
+EMPTY_BLOB() function is a Trafodion SQL extension.
+
+For more information, see 
http://trafodion.incubator.apache.org/docs/lob_guide/index.html[Trafodion SQL 
Large Objects Guide].
+
+```
+EMPTY_BLOB()
+```
+
+[[considerations_for_emptyblob_function]]
+=== Considerations for EMPTY_BLOB() Function
+
+* If EMPTY_BLOB() is specified, then a dummy lob handle is created.
+
+** No data is associated with the empty LOBs yet, but these dummy LOB 
handles can later be used to populate with new LOB data. If the LOB had data 
previously associated with it, it will be erased.
+
+** The dummy LOB handle will get the same datatype as the underlying 
column.
++
+For example, if the LOB column was defined as `‘EXTERNAL’` during 
table creation, then the LOB column gets that type. If it’s not defined, then 
it is considered as a regular LOB. 
+
+* An empty LOB is distinct from a LOB containing a string of length zero 
or a null LOB.
+
+[[examples_of_emptyblob_function]]
+=== Examples of EMPTY_BLOB() Function
+
+* This example uses the EMPTY_BLOB to insert an empty LOB and creates a 
dummy LOB handle. 
++
+```
+insert into test1 values (1, empty_blob());
+```
+
+<<<
+[[emptyclob_function]]
+== EMPTY_CLOB() Function
+
+[[syntax_descriptions_of_emptyclob_function]]
+=== Syntax Descriptions of EMPTY_CLOB() Function
+
+The EMPTY_CLOB() function creates a dummy LOB handle with CLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
--- End diff --

"an INSERT or UPDATE statement" or "INSERT or UPDATE statements" sounds 
better to my ears.


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157637971
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -926,6 +944,45 @@ The following are BITAND restrictions:
 --- 1 row(s) selected
 ```
 
+<<<
+[[buffertolob_function]]
+== BUFFERTOLOB Function 
+
+[[buffertolob_function_syntax]]
+=== Syntax Descriptions of BUFFERTOLOB Function
+
+The BUFFERTOLOB function takes an address and a size of an input buffer, 
and converts the data pointed to by that buffer into LOB. This function can be 
used in INSERT or UPDATE statement.
--- End diff --

Again, "...the size..." sounds better to my ears.


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638866
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3679,40 +3863,43 @@ EXTRACT (YEAR FROM INTERVAL '01-09' YEAR TO MONTH)
 +
 The result is 1.
 
-
 <<<
-[[hour_function]]
-=== HOUR Function
+[[filetolob_function]]
+== FILETOLOB Function
 
-The HOUR function converts a TIME or TIMESTAMP expression into an
-INTEGER value in the range 0 through 23 that represents the
-corresponding hour of the day.
+[[filetolob_function_syntax]]
+=== Syntax Descriptions of FILETOLOB Function
 
-HOUR is a {project-name} SQL extension.
+The FILETOLOB function converts data from a local linux/hdfs file into LOB 
format. This function can be used in INSERT or UPDATE statement.  
--- End diff --

same comment as before


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638255
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3405,6 +3461,88 @@ DIFF2_I1TS
 --- 5 row(s) selected.
 ```
 
+<<<
+[[emptyblob_function]]
+== EMPTY_BLOB() Function
+
+[[syntax_descriptions_of_emptyblob_function]]
+=== Syntax Descriptions of EMPTY_BLOB() Function
+
+The EMPTY_BLOB() function creates a dummy LOB handle with BLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
--- End diff --

Either "an INSERT or UPDATE statement" or "INSERT or UPDATE statements" is 
better


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157637747
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -213,6 +213,24 @@ corresponding week of the year.
 
 See the individual entry for the function.
 
+[[lob_functions]]
+== LOB Functions
+
+Trafodion provides following LOB functions to process LOB data.
+
+[cols="25%,75%"]
+|===
+| <<emptyblob_function,EMPTY_BLOB() Function>>   | Creates a dummy LOB 
handle with BLOB.
+| <<emptyclob_function,EMPTY_CLOB() Function>>   | Creates a dummy LOB 
handle with CLOB.
+| <<stringtolob_function,STRINGTOLOB Function>>  | Converts a simple 
string literal into LOB format.
+| <<filetolob_function,FILETOLOB Function>>  | Converts data from a 
local linux/hdfs file into LOB format.
+| <<buffertolob_function,BUFFERTOLOB_Function>> | Takes an address and 
a size of an input buffer, and converts the data pointed to by that buffer into 
LOB format.
--- End diff --

Nit: To my ears, "Takes an address and the size of an input buffer..." 
sounds better. Probably the reason it sounds better to me is that I know the 
address is pointing to the input buffer. So, once we have said "an address" we 
have identified a specific input buffer, and "size" refers to the size of that 
specific buffer. So it requires the definite article rather than the indefinite 
article.

That said, perhaps another way of saying this is, "Takes the address and 
size of an input buffer, and converts the contents of that buffer into LOB 
format."


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157637887
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -213,6 +213,24 @@ corresponding week of the year.
 
 See the individual entry for the function.
 
+[[lob_functions]]
+== LOB Functions
+
+Trafodion provides following LOB functions to process LOB data.
+
+[cols="25%,75%"]
+|===
+| <<emptyblob_function,EMPTY_BLOB() Function>>   | Creates a dummy LOB 
handle with BLOB.
+| <<emptyclob_function,EMPTY_CLOB() Function>>   | Creates a dummy LOB 
handle with CLOB.
+| <<stringtolob_function,STRINGTOLOB Function>>  | Converts a simple 
string literal into LOB format.
+| <<filetolob_function,FILETOLOB Function>>  | Converts data from a 
local linux/hdfs file into LOB format.
+| <<buffertolob_function,BUFFERTOLOB_Function>> | Takes an address and 
a size of an input buffer, and converts the data pointed to by that buffer into 
LOB format.
+| <<externaltolob_function,EXTERNALTOLOB_Function>> | Converts data from 
an external file into LOB format.
+| LOBTOSTRING | Converts LOB data into simple string 
literal.
--- End diff --

I would say, "Converts LOB data into a simple string literal."


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638536
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -3405,6 +3461,88 @@ DIFF2_I1TS
 --- 5 row(s) selected.
 ```
 
+<<<
+[[emptyblob_function]]
+== EMPTY_BLOB() Function
+
+[[syntax_descriptions_of_emptyblob_function]]
+=== Syntax Descriptions of EMPTY_BLOB() Function
+
+The EMPTY_BLOB() function creates a dummy LOB handle with BLOB.
+
+This function can be used in INSERT or UPDATE statement, to initialize a 
LOB column or attribute to EMPTY.
+
+EMPTY_BLOB() function is a Trafodion SQL extension.
+
+For more information, see 
http://trafodion.incubator.apache.org/docs/lob_guide/index.html[Trafodion SQL 
Large Objects Guide].
+
+```
+EMPTY_BLOB()
+```
+
+[[considerations_for_emptyblob_function]]
+=== Considerations for EMPTY_BLOB() Function
+
+* If EMPTY_BLOB() is specified, then a dummy lob handle is created.
+
+** No data is associated with the empty LOBs yet, but these dummy LOB 
handles can later be used to populate with new LOB data. If the LOB had data 
previously associated with it, it will be erased.
+
+** The dummy LOB handle will get the same datatype as the underlying 
column.
++
+For example, if the LOB column was defined as `‘EXTERNAL’` during 
table creation, then the LOB column gets that type. If it’s not defined, then 
it is considered as a regular LOB. 
+
+* An empty LOB is distinct from a LOB containing a string of length zero 
or a null LOB.
+
+[[examples_of_emptyblob_function]]
+=== Examples of EMPTY_BLOB() Function
+
+* This example uses the EMPTY_BLOB to insert an empty LOB and creates a 
dummy LOB handle. 
++
+```
+insert into test1 values (1, empty_blob());
+```
+
+<<<
+[[emptyclob_function]]
+== EMPTY_CLOB() Function
+
+[[syntax_descriptions_of_emptyclob_function]]
+=== Syntax Descriptions of EMPTY_CLOB() Function
+
+The EMPTY_CLOB() function creates a dummy LOB handle with CLOB.
--- End diff --

"...of type CLOB" sounds better to my ears.


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157638107
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -926,6 +944,45 @@ The following are BITAND restrictions:
 --- 1 row(s) selected
 ```
 
+<<<
+[[buffertolob_function]]
+== BUFFERTOLOB Function 
+
+[[buffertolob_function_syntax]]
+=== Syntax Descriptions of BUFFERTOLOB Function
+
+The BUFFERTOLOB function takes an address and a size of an input buffer, 
and converts the data pointed to by that buffer into LOB. This function can be 
used in INSERT or UPDATE statement.
+
+BUFFERTOLOB function is a Trafodion SQL extension.
+
+For more information, see 
http://trafodion.incubator.apache.org/docs/lob_guide/index.html[Trafodion SQL 
Large Objects Guide].
+
+```
+BUFFERTOLOB(LOCATION lob source buffer address, LENGTH lob length value)   
+```
+
+* _lob source buffer address_
++
+The long value of the user buffer address in int64.
--- End diff --

Perhaps, "The int64 value of the user buffer address"?


---


[GitHub] incubator-trafodion pull request #1350: [TRAFODION-2849] Add BLOB and CLOB f...

2017-12-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1350#discussion_r157637289
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -213,6 +213,24 @@ corresponding week of the year.
 
 See the individual entry for the function.
 
+[[lob_functions]]
+== LOB Functions
+
+Trafodion provides following LOB functions to process LOB data.
+
+[cols="25%,75%"]
+|===
+| <<emptyblob_function,EMPTY_BLOB() Function>>   | Creates a dummy LOB 
handle with BLOB.
--- End diff --

Suggested wordsmith: "Creates a dummy LOB handle of type BLOB"


---


[GitHub] incubator-trafodion pull request #1352: [TRAFODION-2398] Revise Message Guid...

2017-12-16 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2398] Revise Message Guide msgs 1146-1199 + isolated others

This change brings the Messages Guide up to date for messages in the range 
1146 through 1199 + a few isolated other messages.

Where messages are no longer used, the documentation for them has been 
removed. Also, text for some unused messages was removed from 
bin/SqlciErrors.txt and enums from various files were removed. A few code 
changes were made to eliminate obsolete code. A few edits to SqlciErrors.txt to 
improve the text were made.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion 
Trafodion2398a

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

https://github.com/apache/incubator-trafodion/pull/1352.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 #1352


commit 4669c079f0ac81604ddc6c965c9442843c857039
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-12-17T00:19:01Z

[TRAFODION-2398] Revise Message Guide msgs 1146-1199 + isolated others




---


[GitHub] incubator-trafodion pull request #1311: [TRAFODION-2818] For Server 2008, fu...

2017-12-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1311#discussion_r153246992
  
--- Diff: win-odbc64/odbcclient/drvr35/sqltocconv.cpp ---
@@ -36,6 +36,34 @@
 
 #define MAXCHARLEN 32768 //32K
 
+// for server2008 when using function pow() then throws 
STATUS_ILLEGAL_INSTRUCTION
+__int64 pow(int base, short scale)
+{
+   DWORD dwVersion = 0;
+   DWORD dwBuild = 0;
+
+   dwVersion = GetVersion();
+
+   // Get the build number.
+
+   if (dwVersion < 0x8000)
+   dwBuild = (DWORD)(HIWORD(dwVersion));
+
+   __int64 retValue = 1;
+   if (dwBuild == 7600)
+   {
+   scale = scale > 18 ? 18 : scale;
+   for (int i = 0; i < scale; i++)
+   retValue = retValue * 10;
--- End diff --

So, if the scale was 19, we would return 10^18? Is this correct? Shouldn't 
there be some sort of overflow error instead?


---


[GitHub] incubator-trafodion pull request #1320: TRAFODION-2823 some test case donot ...

2017-12-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1320#discussion_r156799988
  
--- Diff: 
dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestNetworkTimeout.java
 ---
@@ -64,10 +72,19 @@ public void testGetNetworkTimeout() {
Connection conn = null;
try {
System.out.println("Connecting to database...");
-   conn = Utils.getUserConnection();
+   conn = Utils.getUserConnection();S
--- End diff --

The extra "S" at the end of the line appears to be causing the JDBC build 
failure


---


[GitHub] incubator-trafodion pull request #1340: [TRAFODION-2843] Fix outer join on a...

2017-12-13 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2843] Fix outer join on aggregate bug

Formerly, the code was allowing an uncovered aggregate expression to be 
generated as a before join predicate. This lead to a Generator assert. The test 
for uncovered expressions in Join::preCodeGen has been tightened up so this 
does not happen.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2843

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

https://github.com/apache/incubator-trafodion/pull/1340.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 #1340


commit ccb17c28e7fa74b5c58dbf37a02239316184bdd5
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-12-13T21:04:44Z

[TRAFODION-2843] Fix outer join on aggregate bug




---


[GitHub] incubator-trafodion pull request #1316: [TRAFODION-2822] Make [first n] view...

2017-12-12 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1316#discussion_r156487426
  
--- Diff: core/sql/optimizer/NormRelExpr.cpp ---
@@ -6995,11 +6995,6 @@ NABoolean RelRoot::isUpdatableBasic(NABoolean isView,
   // QSTUFF
 
 {
-  // if child is a FirstN node, skip it.
-  if ((child(0)->castToRelExpr()->getOperatorType() == REL_FIRST_N) &&
- (child(0)->child(0)))
-   scan = (Scan *)child(0)->child(0)->castToRelExpr();
-  else
scan = (Scan *)child(0)->castToRelExpr();
--- End diff --

Thanks, Suresh, for the pointer. While trying to go through the 
RelRoot::preCodeGen() logic and cause a FirstN node to be inserted, I ran into 
this bug:

1. I created a table t1 with six rows.
2. I did "create view v1 as select [first 5] * from t1 order by a;"  (I 
wanted to see if the order by clause was permitted and if so would it 
circumvent the updatable view check. It did!)
3. I did "update v1 set b = 6". It updated 6 rows.

So, it appears that the updatable view test is not as complete as it needs 
to be.

I have written a new JIRA, 
https://issues.apache.org/jira/browse/TRAFODION-2840, to track this problem.


---


[GitHub] incubator-trafodion pull request #1337: [TRAFODION-2838] Add error check to ...

2017-12-12 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2838] Add error check to NATableDB::get

This will prevent cores in  NATable::updateExtTableAttrs when an error 
occurs under the NATable constructor for a Hive table that has a Trafodion 
external table definition.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2838

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

https://github.com/apache/incubator-trafodion/pull/1337.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 #1337






---


[GitHub] incubator-trafodion pull request #1331: [TRAFODION-2835] Add script to aid i...

2017-12-08 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2835] Add script to aid in merge conflict resolution

Very often a conflict occurs because a test has been updated in two 
branches, and that test has output containing DDL timestamps or plan IDs or 
other unimportant information that varies on every regress run. When these are 
the only differences, the conflict resolution is simple: Delete all the HEAD 
stuff and accept all the new stuff. This script does exactly that.

The script looks for lines of the following form:

  <<<<<<< HEAD
  -- Definition current  Wed Nov 29 08:53:46 2017
  ===
  -- Definition current  Wed Dec  6 19:32:34 2017
  >>>>>>> b149874... [TRAFODION-2827] Turn update costing code on by default

When it finds this, it removes the lines from <<<<<< HEAD to ==, and 
removes the final >>>>>> line, leaving just:

  -- Definition current  Wed Dec  6 19:32:34 2017

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2835

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

https://github.com/apache/incubator-trafodion/pull/1331.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 #1331


commit 69e15743d797b62dab7c447aea069facba26e45b
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-12-08T22:55:48Z

[TRAFODION-2835] Add script to aid in merge conflict resolution




---


[GitHub] incubator-trafodion pull request #1326: [TRAFODION-2827] Turn update costing...

2017-12-06 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2827] Turn update costing code on by default

This pull request changes the default for CQD HBASE_UPDATE_COSTING to 'ON'.

The former setting ('OFF') used stub code for update costing, which 
assigned a zero cost to all update operations. Among other effects, it would 
cause update statements to always get serial plans.

The new setting uses a different set of stub code. That code is a copy of 
the delete costing code. I call it "stub" code because the theory of operation 
of update is somewhat different than that for delete. Nevertheless, this code 
should give much better plans than the former stub.

Also included in this pull request are updated expected files for five 
regression tests. In all these cases, an update plan flipped from an update 
node to a tuple_flow(scan,update) plan. Except for unique row accesses, the 
latter plan should always be superior.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2827

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

https://github.com/apache/incubator-trafodion/pull/1326.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 #1326






---


[GitHub] incubator-trafodion pull request #1316: [TRAFODION-2822] Make [first n] view...

2017-12-05 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1316#discussion_r155139480
  
--- Diff: core/sql/optimizer/NormRelExpr.cpp ---
@@ -6995,11 +6995,6 @@ NABoolean RelRoot::isUpdatableBasic(NABoolean isView,
   // QSTUFF
 
 {
-  // if child is a FirstN node, skip it.
-  if ((child(0)->castToRelExpr()->getOperatorType() == REL_FIRST_N) &&
- (child(0)->child(0)))
-   scan = (Scan *)child(0)->child(0)->castToRelExpr();
-  else
scan = (Scan *)child(0)->castToRelExpr();
--- End diff --

I will look into it.


---


[GitHub] incubator-trafodion pull request #1320: TRAFODION-2823 some test case donot ...

2017-12-03 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1320#discussion_r154540542
  
--- Diff: 
dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestWrap.java ---
@@ -51,7 +51,11 @@ public void testIsWrapFor() {
 conn = Utils.getUserConnection();
 boolean result = conn.isWrapperFor(Connection.class);
 assertTrue("It is wrapper for this interface", result);
+conn.close();
 } catch (SQLException e) {
+if (conn !=null) {
+conn.close();
--- End diff --

The Jenkins builds are complaining that this code has an uncaught exception 
of some sort. Could you take a look? Thanks.


---


[GitHub] incubator-trafodion pull request #1319: TRAFODION-2824

2017-11-30 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1319#discussion_r154149096
  
--- Diff: 
core/conn/jdbc_type2/src/main/java/org/apache/trafodion/jdbc/t2/SQLMXPreparedStatement.java
 ---
@@ -2772,7 +2772,7 @@ private void setLong(int parameterIndex) throws 
SQLException {
/**
 * Sets the designated parameter to SQL NULL.
 * 
-* Note: You must specify the parameters SQL type (although HP 
SQL/MX
+* Note: You must specify the parameters SQL type (although 
Trafodion SQL/MX
--- End diff --

Actually, SQL/MX is a reference to the predecessor HP product as well. If 
you wish, consider changing "Trafodion SQL/MX" to just "Trafodion"


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962866
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -523,20 +520,14 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 
  // Throw an error if a column is part of the store by clause and
  // is not defined as NOT NULL return an error
- DDkwd__(CAT_ERROR_ON_NOTNULL_STOREBY, "ON"),
 
- DDui1__(CAT_FS_TIMEOUT,   "9000"),
 
  // Used to make ignore "already exists" error in Create and
  // "does not exist" error in Drop.
- DDkwd__(CAT_IGNORE_ALREADY_EXISTS_ERROR, "OFF"),
- DDkwd__(CAT_IGNORE_DOES_NOT_EXIST_ERROR, "OFF"),
 
  // Used to make catman test134 predictable
- DDkwd__(CAT_IGNORE_EMPTY_CATALOGS, "OFF"),
 
  // Catalog Manager internal support for REPLICATE AUTHORIZATION
- DDkwd__(CAT_IGNORE_REPL_AUTHIDS_ERROR, "OFF"),
 
 // This enables the DB Limits functionality.  If set to OFF, then blocksize
 // is restricted to 4096 and clustering key size is limited to 255 bytes.
--- End diff --

And above


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962885
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -547,40 +538,29 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 // If DB Limits is enabled, then increase the default blocksize to 32K
 // on NSK if the object's clustering key length is larger than this value.
--- End diff --

And here


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962829
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -523,20 +520,14 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 
  // Throw an error if a column is part of the store by clause and
  // is not defined as NOT NULL return an error
- DDkwd__(CAT_ERROR_ON_NOTNULL_STOREBY, "ON"),
 
- DDui1__(CAT_FS_TIMEOUT,   "9000"),
 
  // Used to make ignore "already exists" error in Create and
  // "does not exist" error in Drop.
- DDkwd__(CAT_IGNORE_ALREADY_EXISTS_ERROR, "OFF"),
- DDkwd__(CAT_IGNORE_DOES_NOT_EXIST_ERROR, "OFF"),
 
  // Used to make catman test134 predictable
- DDkwd__(CAT_IGNORE_EMPTY_CATALOGS, "OFF"),
 
  // Catalog Manager internal support for REPLICATE AUTHORIZATION
--- End diff --

And here


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962727
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -523,20 +520,14 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 
  // Throw an error if a column is part of the store by clause and
  // is not defined as NOT NULL return an error
--- End diff --

Comment should be deleted too.


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962963
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -547,40 +538,29 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 // If DB Limits is enabled, then increase the default blocksize to 32K
 // on NSK if the object's clustering key length is larger than this value.
 
-  DDui1__(CAT_LARGE_BLOCKS_MAX_KEYSIZE,   "1"),
 
 // If DB Limits is enabled, then increase the default blocksize to 32K
 // on NSK if the object's row size is larger than this value.
 
-  DDui1__(CAT_LARGE_BLOCKS_MAX_ROWSIZE,   "1"),
 
 // Controls how pathnames for routines/procedures/SPJs are interpreted
   DDkwd__(CAT_LIBRARY_PATH_RELATIVE, "OFF"),
 
-  DDkwd__(CAT_MORE_SCHEMA_PRIVS, "ON"),
 
-  DDkwd__(CAT_OVERRIDE_CREATE_DISABLE, "OFF"),
 
 
 // This forces an rcb to be created with a different version number
 // A "0" means to take the current mxv version
--- End diff --

And in numerous additional places


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962765
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -523,20 +520,14 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 
  // Throw an error if a column is part of the store by clause and
  // is not defined as NOT NULL return an error
- DDkwd__(CAT_ERROR_ON_NOTNULL_STOREBY, "ON"),
 
- DDui1__(CAT_FS_TIMEOUT,   "9000"),
 
  // Used to make ignore "already exists" error in Create and
  // "does not exist" error in Drop.
--- End diff --

Comment should be deleted too.


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962902
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -547,40 +538,29 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 // If DB Limits is enabled, then increase the default blocksize to 32K
 // on NSK if the object's clustering key length is larger than this value.
 
-  DDui1__(CAT_LARGE_BLOCKS_MAX_KEYSIZE,   "1"),
 
 // If DB Limits is enabled, then increase the default blocksize to 32K
 // on NSK if the object's row size is larger than this value.
--- End diff --

And here


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962681
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -503,9 +502,7 @@ SDDkwd__(ALLOW_DP2_ROW_SAMPLING,   
"SYSTEM"),
  DDkwd__(CAT_ALLOW_NEW_FEATUREX, "OFF"),
 
 // Control whether authorization caches immutable users
--- End diff --

Comment should be deleted too.


---


[GitHub] incubator-trafodion pull request #1317: JIRA TRAFODION-2731 CodeCleanup: Pha...

2017-11-29 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1317#discussion_r153962796
  
--- Diff: core/sql/sqlcomp/nadefaults.cpp ---
@@ -523,20 +520,14 @@ SDDkwd__(CAT_ENABLE_QUERY_INVALIDATION, "ON"),
 
  // Throw an error if a column is part of the store by clause and
  // is not defined as NOT NULL return an error
- DDkwd__(CAT_ERROR_ON_NOTNULL_STOREBY, "ON"),
 
- DDui1__(CAT_FS_TIMEOUT,   "9000"),
 
  // Used to make ignore "already exists" error in Create and
  // "does not exist" error in Drop.
- DDkwd__(CAT_IGNORE_ALREADY_EXISTS_ERROR, "OFF"),
- DDkwd__(CAT_IGNORE_DOES_NOT_EXIST_ERROR, "OFF"),
 
  // Used to make catman test134 predictable
--- End diff --

And here


---


[GitHub] incubator-trafodion pull request #1316: [TRAFODION-2822] Make [first n] view...

2017-11-29 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2822] Make [first n] views non-updatable; prevent bad MERGE plans

This pull request contains two changes:

1. Views defined using [first n] or [any n] are now marked as not updatable 
and not insertable. So, when a MERGE statement is attempted on a new view of 
this type, we will get a compile time error that the view is not insertable or 
updatable (instead of getting an incorrect result).

2. MERGE statements that have a WHEN NOT MATCHED INSERT action are 
prevented from undergoing a tuple substitution transformation (that is, the 
TSJRule and TSJFlowRule will not fire on a merge node possessing a WHEN NOT 
MATCHED INSERT action). This is necessary because the run-time implementation 
of insert actions takes place in the merge node itself; that is, scanning has 
to happen in the merge node. These two rules would take the scanning out of the 
merge node into a separate scan node.

Note: Existing [first n] / [any n] views remain marked as updatable and 
insertable. (These attributes are calculated at CREATE VIEW time and stored in 
the metadata.) The second change above will cause MERGE statements having WHEN 
NOT MATCHED INSERT actions to fail at compile time against such views with an 
error 2235 (Optimizer could not produce a plan for the statement). While this 
is a non-obvious error from a user perspective it is far better than allowing 
execution and getting an incorrect result.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2822

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

https://github.com/apache/incubator-trafodion/pull/1316.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 #1316






---


[GitHub] incubator-trafodion pull request #1314: [TRAFODION-2821] Trafodion core code...

2017-11-28 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1314#discussion_r153627095
  
--- Diff: core/sql/executor/OrcFileReader.cpp ---
@@ -122,24 +150,28 @@ OFR_RetCode OrcFileReader::init()
 OFR_RetCode OrcFileReader::open(const char* path)
 {
   QRLogger::log(CAT_SQL_HDFS_ORC_FILE_READER, LL_DEBUG, 
"OrcFileReader::open(%s) called.", path);
+
+  if (initJNIEnv() != JOI_OK)
+ return OFR_ERROR_OPEN_PARAM;
   jstring js_path = jenv_->NewStringUTF(path);
   if (js_path == NULL) 
+  {
+jenv_->PopLocalFrame(NULL);
--- End diff --

Thanks.


---


[GitHub] incubator-trafodion pull request #1314: [TRAFODION-2821] Trafodion core code...

2017-11-28 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1314#discussion_r153627063
  
--- Diff: core/sql/executor/OrcFileReader.cpp ---
@@ -111,9 +133,15 @@ OFR_RetCode OrcFileReader::init()
 //JavaMethods_[JM_FETCHBUFF2].jm_signature = "(II)[Ljava/lang/String;";
 JavaMethods_[JM_CLOSE ].jm_name  = "close";
 JavaMethods_[JM_CLOSE ].jm_signature = "()Ljava/lang/String;";
-   
-return (OFR_RetCode)JavaObjectInterface::init(className, javaClass_, 
JavaMethods_, (Int32)JM_LAST, FALSE);
+
+lv_retcode = (OFR_RetCode)JavaObjectInterface::init(className,
+   javaClass_,
+   JavaMethods_,
+   (Int32)JM_LAST, 
javaMethodsInitialized_);
+javaMethodsInitialized_ = TRUE;
--- End diff --

That's fine.


---


[GitHub] incubator-trafodion pull request #1314: [TRAFODION-2821] Trafodion core code...

2017-11-28 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1314#discussion_r153565344
  
--- Diff: core/sql/executor/OrcFileReader.cpp ---
@@ -122,24 +150,28 @@ OFR_RetCode OrcFileReader::init()
 OFR_RetCode OrcFileReader::open(const char* path)
 {
   QRLogger::log(CAT_SQL_HDFS_ORC_FILE_READER, LL_DEBUG, 
"OrcFileReader::open(%s) called.", path);
+
+  if (initJNIEnv() != JOI_OK)
+ return OFR_ERROR_OPEN_PARAM;
   jstring js_path = jenv_->NewStringUTF(path);
   if (js_path == NULL) 
+  {
+jenv_->PopLocalFrame(NULL);
--- End diff --

I'm a little confused about the rules for when a call to PopLocalFrame is 
needed. Is it needed whenever we have previously done a call into any jenv_ 
method? (in this case NewStringUTF).


---


[GitHub] incubator-trafodion pull request #1314: [TRAFODION-2821] Trafodion core code...

2017-11-28 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1314#discussion_r153565806
  
--- Diff: core/sql/executor/OrcFileReader.cpp ---
@@ -236,58 +314,71 @@ OFR_RetCode OrcFileReader::fetchNextRow(char * 
buffer, long& array_length, long&
 
 tsRecentJMFromJNI = JavaMethods_[JM_FETCHROW2].jm_full_name;
jobject jresult = (jobject)jenv_->CallObjectMethod(javaObj_, 
JavaMethods_[JM_FETCHROW2].methodID);
+if (jenv_->ExceptionCheck()) 
+{
+  getExceptionDetails();
+  logError(CAT_SQL_HDFS_ORC_FILE_READER, __FILE__, __LINE__);
+  logError(CAT_SQL_HDFS_ORC_FILE_READER, 
"OrcFileReader::fetchNextRow()", getLastError());
+  jenv_->PopLocalFrame(NULL);
+  return OFR_ERROR_FETCHROW_EXCEPTION;
+}
if (jresult==NULL && getLastError()) 
{
- logError(CAT_SQL_HDFS_ORC_FILE_READER, 
"OrcFileReader::fetchNextRow()", getLastError());
- return OFR_ERROR_FETCHROW_EXCEPTION;
+ logError(CAT_SQL_HDFS_ORC_FILE_READER, 
"OrcFileReader::fetchNextRow()", getLastError());
+ return OFR_ERROR_FETCHROW_EXCEPTION;
}
 
if (jresult == NULL)
-   return (OFR_NOMORE);//No more rows
+  return (OFR_NOMORE); //No more rows
 
 //Retrieve row and associated data 
jclass cls = jenv_->GetObjectClass(jresult);

fid = jenv_->GetFieldID(cls,"m_row_length","I");
if (fid ==NULL)
-   {
-   return (OFR_ERROR_FETCHROW_EXCEPTION);
-   }   
+   {
+   jenv_->PopLocalFrame(NULL);
+  return (OFR_ERROR_FETCHROW_EXCEPTION);
+   }   
jint row_length = (jint)jenv_->GetIntField(jresult, fid);
array_length = (long)row_length;
 
-   
fid = jenv_->GetFieldID(cls,"m_column_count","I");
if (fid ==NULL)
-   {
-   return(OFR_ERROR_FETCHROW_EXCEPTION);
-   }
+   {
+   jenv_->PopLocalFrame(NULL);
+   return(OFR_ERROR_FETCHROW_EXCEPTION);
+   }
jint column_count = (jint)jenv_->GetIntField(jresult, fid);
num_columns = column_count;
 
fid = jenv_->GetFieldID(cls,"m_row_number","J");
if (fid ==NULL)
-   {
-   return(OFR_ERROR_FETCHROW_EXCEPTION);
-   }
+   {
+   jenv_->PopLocalFrame(NULL);
+  return(OFR_ERROR_FETCHROW_EXCEPTION);
+   }
jlong rowNum = (jlong)jenv_->GetIntField(jresult, fid);
rowNumber = rowNum;
-
-   
 // Get the actual row (it is a byte array). Use the row_length above to 
specify how much to copy   
fid = jenv_->GetFieldID(cls,"m_row_ba","[B");
if (fid ==NULL)
-   {
-   return (OFR_ERROR_FETCHROW_EXCEPTION);
-   }
+   {
+   jenv_->PopLocalFrame(NULL);
+  return (OFR_ERROR_FETCHROW_EXCEPTION);
+   }
jbyteArray jrow = (jbyteArray)jenv_->GetObjectField(jresult, fid);
 
-  if (jrow == NULL)
-   return (OFR_ERROR_FETCHROW_EXCEPTION);
+if (jrow == NULL)
+{
+   jenv_->PopLocalFrame(NULL);
+   return (OFR_ERROR_FETCHROW_EXCEPTION);
+}
 
-   jenv_->GetByteArrayRegion(jrow, 0, row_length, (jbyte*)buffer);
-   jenv_->DeleteLocalRef(jrow);  
+   jenv_->GetByteArrayRegion(jrow, 0, row_length, (jbyte*)buffer);
+   jenv_->DeleteLocalRef(jrow);  
--- End diff --

I assume the DeleteLocalRef call is no longer needed (since we do a 
PopLocalFrame after this) but it is harmless?


---


[GitHub] incubator-trafodion pull request #1312: [TRAFODION-2819] Fix 4247 error on d...

2017-11-27 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2819] Fix 4247 error on drop table when certain CQDs are present

When CQD TRAF_MAX_CHARACTER_COL_LENGTH is set to a value lower than '500', 
then DROP TABLE will fail when it tries to do a DELETE under the covers on the 
SB_HISTOGRAMS table. The latter fails with error 4247, raised in 
CmpSeabaseDDL::getColInfo (sqlcomp/CmpSeabaseDDLcommon.cpp).

The fix is to change CmpSeabaseDDL::getColInfo to exempt metadata, 
histogram and repository tables from the maximum column length check.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2819

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

https://github.com/apache/incubator-trafodion/pull/1312.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 #1312


commit d96f3c7c136eab380acbd3f481ff1f738e16306d
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-11-27T21:35:35Z

[TRAFODION-2819] Fix 4247 error on drop table when certain CQDs are present




---


[GitHub] incubator-trafodion pull request #1309: [TRAFODION-2815] Add/Update Syntax, ...

2017-11-22 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1309#discussion_r152657575
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2297,19 +2297,22 @@ DATEADD(DAY, 7, timestamp'2008-02-29 00:00:00')
 == DATEDIFF Function
 
 The DATEDIFF function returns the integer value for the number of
-_datepart_ units of time between _startdate_ and _enddate_. If
-_enddate_ precedes _startdate_, the return value is negative or zero.
+_datepart_ units of time between _startdate_ and _enddate_. 
 
 DATEDIFF is a {project-name} SQL extension.
 
 ```
 DATEDIFF (datepart, startdate, enddate)
 ```
 
+<<<
+[[syntax_description_of_datediff]]
+=== Syntax Description of DATEDIFF 
+
 * `datepart`
 +
 is YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, QUARTER, WEEK, or one of the
-following abbreviations:
+following abbreviations, should be enclosed in quotation marks:
--- End diff --

Finished research. Verified that the abbreviations do not take quotes.


---


[GitHub] incubator-trafodion pull request #1309: [TRAFODION-2815] Add/Update Syntax, ...

2017-11-22 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1309#discussion_r152651211
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2325,82 +2328,206 @@ following abbreviations:
 
 * `startdate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
 * `enddate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
-The method of counting crossed boundaries such as days, minutes, and
-seconds makes the result given by DATEDIFF consistent across all data
-types. The result is a signed integer value equal to the number of
-datepart boundaries crossed between the first and second date.
-
-For example, the number of weeks between Sunday, January 4, and Sunday,
-January 1 , is 1. The number of months between March 31 and April 1
-would be 1 because the month boundary is crossed from March to April.
-The DATEDIFF function generates an error if the result is out of range
-for integer values. For seconds, the maximum number is equivalent to
-approximately 68 years. The DATEDIFF function generates an error if a
-difference in weeks is requested and one of the two dates precedes
-January 7 of the year 0001.
+[[considerations_for_datediff]]
+=== Considerations for DATEDIFF 
+
+[[boundary]]
+ Boundary
+
+The method of counting crossed boundaries such as days, minutes, and 
seconds makes the result given by DATEDIFF consistent across all data types. 
+
+The result is a signed integer value equal to the number of _datepart_ 
boundaries crossed between _startdate_ and _enddate_, because the DATEDIFF 
function does not calculate the full _datepart_, it counts the difference 
between _startdate_  and _enddate_.
+
+For example:  
+
+* The difference between 2017-12-31 23:59:59 and 2018-01-01 00:00:00 is 
only a single second. 
+
++
+However, the DATEDIFF difference is 1 minute, 1 hour, 1 day, 0 week^1^, 1 
month, 1 quarter or 1 month depending on the specified _datepart_.
+
++
+^1^ NOTE: 2017-12-31 (_startdate_) falls on Sunday which cannot be 
counted. For more information, see <<the_first_day_of_week,The first day of 
week>>.
+
+* Likewise, the difference between 2017-01-01 and 2018-12-31 is almost two 
years.
+
++
+However, the DATEDIFF difference is 1 year if the specified _datepart_ is 
YEAR.
+
+[[the_first_day_of_week]]
+ The first day of week
+
+* This value cannot be specified, the default value is Sunday.
+
+* The DATEDIFF function returns the number of Sundays between _startdate_ 
and _enddate_. This function counts _enddate_ if it falls on Sunday, but 
doesn't count _startdate_ even if it does fall on a Sunday.
+
++
+For example,
+
+** The DATEDIFF difference is 1 between 2017-11-19 and 2017-11-26 if the 
specified _datepart_ is WEEK.
+
+** The DATEDIFF difference is 0 between 2017-11-19 and 2017-11-25 if the 
specified _datepart_ is WEEK.
+
+[[the_first_week_of_year]]
+ The first week of year
+
+This value cannot be specified, the default value is the week in which Jan 
1 occurs.  
+
+[[negative_or_zero]]
+ Negative or zero
+
+If _enddate_ precedes _startdate_, the return value is negative or zero.
+
+[[error]]
+ Error
+
+* The DATEDIFF function generates an error if the result is out of range 
for integer values. 
+
+** For seconds, the maximum number is equivalent to approximately 68 
years. 
+
+** For weeks, if a difference in weeks is requested, one of the two dates 
cannot precede 0001-01-07.
--- End diff --

Possible wordsmith: "For weeks, the dates must be later than 0001-01-07."


---


[GitHub] incubator-trafodion pull request #1309: [TRAFODION-2815] Add/Update Syntax, ...

2017-11-22 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1309#discussion_r152649487
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2297,19 +2297,22 @@ DATEADD(DAY, 7, timestamp'2008-02-29 00:00:00')
 == DATEDIFF Function
 
 The DATEDIFF function returns the integer value for the number of
-_datepart_ units of time between _startdate_ and _enddate_. If
-_enddate_ precedes _startdate_, the return value is negative or zero.
+_datepart_ units of time between _startdate_ and _enddate_. 
 
 DATEDIFF is a {project-name} SQL extension.
 
 ```
 DATEDIFF (datepart, startdate, enddate)
 ```
 
+<<<
+[[syntax_description_of_datediff]]
+=== Syntax Description of DATEDIFF 
+
 * `datepart`
 +
 is YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, QUARTER, WEEK, or one of the
-following abbreviations:
+following abbreviations, should be enclosed in quotation marks:
--- End diff --

I am not sure this is correct. I tried using MI, for example, and found 
that with quotes I get a syntax error, but without quotes, it works. I am 
researching this issue.


---


[GitHub] incubator-trafodion pull request #1309: [TRAFODION-2815] Add/Update Syntax, ...

2017-11-22 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1309#discussion_r152650488
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2325,82 +2328,206 @@ following abbreviations:
 
 * `startdate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
 * `enddate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
-The method of counting crossed boundaries such as days, minutes, and
-seconds makes the result given by DATEDIFF consistent across all data
-types. The result is a signed integer value equal to the number of
-datepart boundaries crossed between the first and second date.
-
-For example, the number of weeks between Sunday, January 4, and Sunday,
-January 1 , is 1. The number of months between March 31 and April 1
-would be 1 because the month boundary is crossed from March to April.
-The DATEDIFF function generates an error if the result is out of range
-for integer values. For seconds, the maximum number is equivalent to
-approximately 68 years. The DATEDIFF function generates an error if a
-difference in weeks is requested and one of the two dates precedes
-January 7 of the year 0001.
+[[considerations_for_datediff]]
+=== Considerations for DATEDIFF 
+
+[[boundary]]
+ Boundary
+
+The method of counting crossed boundaries such as days, minutes, and 
seconds makes the result given by DATEDIFF consistent across all data types. 
+
+The result is a signed integer value equal to the number of _datepart_ 
boundaries crossed between _startdate_ and _enddate_, because the DATEDIFF 
function does not calculate the full _datepart_, it counts the difference 
between _startdate_  and _enddate_.
+
+For example:  
+
+* The difference between 2017-12-31 23:59:59 and 2018-01-01 00:00:00 is 
only a single second. 
+
++
+However, the DATEDIFF difference is 1 minute, 1 hour, 1 day, 0 week^1^, 1 
month, 1 quarter or 1 month depending on the specified _datepart_.
+
++
+^1^ NOTE: 2017-12-31 (_startdate_) falls on Sunday which cannot be 
counted. For more information, see <<the_first_day_of_week,The first day of 
week>>.
+
+* Likewise, the difference between 2017-01-01 and 2018-12-31 is almost two 
years.
+
++
+However, the DATEDIFF difference is 1 year if the specified _datepart_ is 
YEAR.
+
+[[the_first_day_of_week]]
+ The first day of week
+
+* This value cannot be specified, the default value is Sunday.
--- End diff --

Possible wordsmith: "The first day of the week is Sunday. Changing the 
first day of the week is not supported."


---


[GitHub] incubator-trafodion pull request #1309: [TRAFODION-2815] Add/Update Syntax, ...

2017-11-22 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1309#discussion_r152650793
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2325,82 +2328,206 @@ following abbreviations:
 
 * `startdate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
 * `enddate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
-The method of counting crossed boundaries such as days, minutes, and
-seconds makes the result given by DATEDIFF consistent across all data
-types. The result is a signed integer value equal to the number of
-datepart boundaries crossed between the first and second date.
-
-For example, the number of weeks between Sunday, January 4, and Sunday,
-January 1 , is 1. The number of months between March 31 and April 1
-would be 1 because the month boundary is crossed from March to April.
-The DATEDIFF function generates an error if the result is out of range
-for integer values. For seconds, the maximum number is equivalent to
-approximately 68 years. The DATEDIFF function generates an error if a
-difference in weeks is requested and one of the two dates precedes
-January 7 of the year 0001.
+[[considerations_for_datediff]]
+=== Considerations for DATEDIFF 
+
+[[boundary]]
+ Boundary
+
+The method of counting crossed boundaries such as days, minutes, and 
seconds makes the result given by DATEDIFF consistent across all data types. 
+
+The result is a signed integer value equal to the number of _datepart_ 
boundaries crossed between _startdate_ and _enddate_, because the DATEDIFF 
function does not calculate the full _datepart_, it counts the difference 
between _startdate_  and _enddate_.
+
+For example:  
+
+* The difference between 2017-12-31 23:59:59 and 2018-01-01 00:00:00 is 
only a single second. 
+
++
+However, the DATEDIFF difference is 1 minute, 1 hour, 1 day, 0 week^1^, 1 
month, 1 quarter or 1 month depending on the specified _datepart_.
+
++
+^1^ NOTE: 2017-12-31 (_startdate_) falls on Sunday which cannot be 
counted. For more information, see <<the_first_day_of_week,The first day of 
week>>.
+
+* Likewise, the difference between 2017-01-01 and 2018-12-31 is almost two 
years.
+
++
+However, the DATEDIFF difference is 1 year if the specified _datepart_ is 
YEAR.
+
+[[the_first_day_of_week]]
+ The first day of week
+
+* This value cannot be specified, the default value is Sunday.
+
+* The DATEDIFF function returns the number of Sundays between _startdate_ 
and _enddate_. This function counts _enddate_ if it falls on Sunday, but 
doesn't count _startdate_ even if it does fall on a Sunday.
+
++
+For example,
+
+** The DATEDIFF difference is 1 between 2017-11-19 and 2017-11-26 if the 
specified _datepart_ is WEEK.
+
+** The DATEDIFF difference is 0 between 2017-11-19 and 2017-11-25 if the 
specified _datepart_ is WEEK.
+
+[[the_first_week_of_year]]
+ The first week of year
+
+This value cannot be specified, the default value is the week in which Jan 
1 occurs.  
--- End diff --

Possible wordsmith: "The first week of the year is the week in which 
January 1 occurs. Changing the first week of the year is not supported."


---


[GitHub] incubator-trafodion pull request #1309: [TRAFODION-2815] Add/Update Syntax, ...

2017-11-22 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1309#discussion_r152651447
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2325,82 +2328,206 @@ following abbreviations:
 
 * `startdate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
 * `enddate`
 +
-may be of type DATE or TIMESTAMP.
+may be of type DATE or TIMESTAMP, should be enclosed in quotation marks.
 See <<datetime_value_expressions,Datetime Value Expressions>>.
 
-The method of counting crossed boundaries such as days, minutes, and
-seconds makes the result given by DATEDIFF consistent across all data
-types. The result is a signed integer value equal to the number of
-datepart boundaries crossed between the first and second date.
-
-For example, the number of weeks between Sunday, January 4, and Sunday,
-January 1 , is 1. The number of months between March 31 and April 1
-would be 1 because the month boundary is crossed from March to April.
-The DATEDIFF function generates an error if the result is out of range
-for integer values. For seconds, the maximum number is equivalent to
-approximately 68 years. The DATEDIFF function generates an error if a
-difference in weeks is requested and one of the two dates precedes
-January 7 of the year 0001.
+[[considerations_for_datediff]]
+=== Considerations for DATEDIFF 
+
+[[boundary]]
+ Boundary
+
+The method of counting crossed boundaries such as days, minutes, and 
seconds makes the result given by DATEDIFF consistent across all data types. 
+
+The result is a signed integer value equal to the number of _datepart_ 
boundaries crossed between _startdate_ and _enddate_, because the DATEDIFF 
function does not calculate the full _datepart_, it counts the difference 
between _startdate_  and _enddate_.
+
+For example:  
+
+* The difference between 2017-12-31 23:59:59 and 2018-01-01 00:00:00 is 
only a single second. 
+
++
+However, the DATEDIFF difference is 1 minute, 1 hour, 1 day, 0 week^1^, 1 
month, 1 quarter or 1 month depending on the specified _datepart_.
+
++
+^1^ NOTE: 2017-12-31 (_startdate_) falls on Sunday which cannot be 
counted. For more information, see <<the_first_day_of_week,The first day of 
week>>.
+
+* Likewise, the difference between 2017-01-01 and 2018-12-31 is almost two 
years.
+
++
+However, the DATEDIFF difference is 1 year if the specified _datepart_ is 
YEAR.
+
+[[the_first_day_of_week]]
+ The first day of week
+
+* This value cannot be specified, the default value is Sunday.
+
+* The DATEDIFF function returns the number of Sundays between _startdate_ 
and _enddate_. This function counts _enddate_ if it falls on Sunday, but 
doesn't count _startdate_ even if it does fall on a Sunday.
+
++
+For example,
+
+** The DATEDIFF difference is 1 between 2017-11-19 and 2017-11-26 if the 
specified _datepart_ is WEEK.
+
+** The DATEDIFF difference is 0 between 2017-11-19 and 2017-11-25 if the 
specified _datepart_ is WEEK.
+
+[[the_first_week_of_year]]
+ The first week of year
+
+This value cannot be specified, the default value is the week in which Jan 
1 occurs.  
+
+[[negative_or_zero]]
+ Negative or zero
+
+If _enddate_ precedes _startdate_, the return value is negative or zero.
+
+[[error]]
+ Error
+
+* The DATEDIFF function generates an error if the result is out of range 
for integer values. 
+
+** For seconds, the maximum number is equivalent to approximately 68 
years. 
+
+** For weeks, if a difference in weeks is requested, one of the two dates 
cannot precede 0001-01-07.
 
 <<<
 [[examples_of_datediff]]
 === Examples of DATEDIFF
 
-* This function returns the value of 0 because no one-second boundaries
-are crossed.
+[[date_difference_in_second]]
+ Date Difference in SECOND
+
+* This function returns the value of 0 because no one-second boundary
+is crossed.
 +
 ```
-DATEDIFF( SECOND
-, TIMESTAMP '2006-09-12 11:59:58.98'
-, TIMESTAMP '2006-09-12 11:59:58.99'
-)
+SELECT DATEDIFF( SECOND
+ , TIMESTAMP '2006-09-12 11:59:58.98'
+ , TIMESTAMP '2006-09-12 11:59:58.99'
+   )
+FROM DUAL;
 ```
 
 * This function returns the value 1 because a one-second boundary is
 crossed even though the two timestamps differ by only one micro

[GitHub] incubator-trafodion pull request #1308: [TRAFODION-2814] Fix error message 2...

2017-11-21 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2814] Fix error message 2243

Replace mention of predecessor products with Trafodion equivalents.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2814

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

https://github.com/apache/incubator-trafodion/pull/1308.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 #1308


commit d26e1099db2206039d7c4e01e9a90cf61b756259
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-11-21T23:48:50Z

[TRAFODION-2814] Fix error message 2243




---


[GitHub] incubator-trafodion pull request #1306: [TRAFODION-2813] Ignore leading salt...

2017-11-21 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1306#discussion_r152361479
  
--- Diff: core/sql/optimizer/IndexDesc.cpp ---
@@ -802,10 +802,30 @@ IndexProperty::compareIndexPromise(const 
IndexProperty *ixProp) const
 
 const IndexDesc * index = getIndexDesc();
 const IndexDesc * otherIndex = ixProp->getIndexDesc();
-if ( ((IndexColumn 
*)(index->getIndexKey()[0]).getItemExpr())->getDefinition() != 
- ((IndexColumn 
*)(otherIndex->getIndexKey()[0]).getItemExpr())->getDefinition() )
-
-  return INCOMPATIBLE;
+
+// If the two indexes have differing leading columns, consider them 
incompatible.
+// For this check, we ignore the "_SALT_" column if both are salted.
+CollIndex columnToCheck = 0;
+NABoolean done = FALSE;
+while (!done)
+  {
+if (columnToCheck >= index->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else if (columnToCheck >= otherIndex->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else
+  {
+IndexColumn * indexCol = (IndexColumn 
*)(index->getIndexKey()[columnToCheck]).getItemExpr();
+IndexColumn * otherIndexCol = (IndexColumn 
*)(otherIndex->getIndexKey()[columnToCheck]).getItemExpr();
+if ( indexCol->getNAColumn()->isSaltColumn() &&
+ otherIndexCol->getNAColumn()->isSaltColumn() )
--- End diff --

OK. Now a question: Can an index have a different divisioning column than 
the base table? Or can I assume that if NAColumn::isDivisioningColumn() returns 
true for both index and otherIndex that they are the same column?


---


[GitHub] incubator-trafodion pull request #1306: [TRAFODION-2813] Ignore leading salt...

2017-11-21 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1306#discussion_r152352674
  
--- Diff: core/sql/optimizer/IndexDesc.cpp ---
@@ -802,10 +802,30 @@ IndexProperty::compareIndexPromise(const 
IndexProperty *ixProp) const
 
 const IndexDesc * index = getIndexDesc();
 const IndexDesc * otherIndex = ixProp->getIndexDesc();
-if ( ((IndexColumn 
*)(index->getIndexKey()[0]).getItemExpr())->getDefinition() != 
- ((IndexColumn 
*)(otherIndex->getIndexKey()[0]).getItemExpr())->getDefinition() )
-
-  return INCOMPATIBLE;
+
+// If the two indexes have differing leading columns, consider them 
incompatible.
+// For this check, we ignore the "_SALT_" column if both are salted.
+CollIndex columnToCheck = 0;
+NABoolean done = FALSE;
+while (!done)
+  {
+if (columnToCheck >= index->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else if (columnToCheck >= otherIndex->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else
+  {
+IndexColumn * indexCol = (IndexColumn 
*)(index->getIndexKey()[columnToCheck]).getItemExpr();
+IndexColumn * otherIndexCol = (IndexColumn 
*)(otherIndex->getIndexKey()[columnToCheck]).getItemExpr();
+if ( indexCol->getNAColumn()->isSaltColumn() &&
+ otherIndexCol->getNAColumn()->isSaltColumn() )
--- End diff --

It depends. Suppose the DIVISION BY clause is on C. Should we think of ix1 
as an index on C, A or just on A? If I have a query, select c from table where 
c = value, then ix1 and ix2 are compatible for that query. Today, 
IndexProperty::compareIndexPromise doesn't take the select predicates into 
account; it is just looking for the "best" index on C. (And on A. And on B.)


---


[GitHub] incubator-trafodion pull request #1306: [TRAFODION-2813] Ignore leading salt...

2017-11-21 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1306#discussion_r152340197
  
--- Diff: core/sql/optimizer/IndexDesc.cpp ---
@@ -802,10 +802,30 @@ IndexProperty::compareIndexPromise(const 
IndexProperty *ixProp) const
 
 const IndexDesc * index = getIndexDesc();
 const IndexDesc * otherIndex = ixProp->getIndexDesc();
-if ( ((IndexColumn 
*)(index->getIndexKey()[0]).getItemExpr())->getDefinition() != 
- ((IndexColumn 
*)(otherIndex->getIndexKey()[0]).getItemExpr())->getDefinition() )
-
-  return INCOMPATIBLE;
+
+// If the two indexes have differing leading columns, consider them 
incompatible.
+// For this check, we ignore the "_SALT_" column if both are salted.
+CollIndex columnToCheck = 0;
+NABoolean done = FALSE;
+while (!done)
+  {
+if (columnToCheck >= index->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else if (columnToCheck >= otherIndex->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else
+  {
+IndexColumn * indexCol = (IndexColumn 
*)(index->getIndexKey()[columnToCheck]).getItemExpr();
+IndexColumn * otherIndexCol = (IndexColumn 
*)(otherIndex->getIndexKey()[columnToCheck]).getItemExpr();
+if ( indexCol->getNAColumn()->isSaltColumn() &&
+ otherIndexCol->getNAColumn()->isSaltColumn() )
--- End diff --

I considered that. I think the intent of the code in 
IndexProperty::compareIndexPromise is, for each user column, to retain the 
"best" (in some sense) index that begins with that column. The salt column is 
not a user column in any sense; with the exception of pre-partitioning rows 
across regions, a user would never have a predicate on salt. A divisioning 
column is a fuzzy area. It is a system-generated column, but it reflects true 
user content. A user predicate may well result in a predicate on the 
divisioning column. So, I thought it was more in tune with the spirit of 
IndexProperty::compareIndexPromise to treat divisioning columns like user 
columns. But I do not feel strongly about it; a case could be made the other 
way.


---


[GitHub] incubator-trafodion pull request #1306: [TRAFODION-2813] Ignore leading salt...

2017-11-20 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1306#discussion_r152154876
  
--- Diff: core/sql/optimizer/IndexDesc.cpp ---
@@ -802,10 +802,30 @@ IndexProperty::compareIndexPromise(const 
IndexProperty *ixProp) const
 
 const IndexDesc * index = getIndexDesc();
 const IndexDesc * otherIndex = ixProp->getIndexDesc();
-if ( ((IndexColumn 
*)(index->getIndexKey()[0]).getItemExpr())->getDefinition() != 
- ((IndexColumn 
*)(otherIndex->getIndexKey()[0]).getItemExpr())->getDefinition() )
-
-  return INCOMPATIBLE;
+
+// If the two indexes have differing leading columns, consider them 
incompatible.
+// For this check, we ignore the "_SALT_" column if both are salted.
+CollIndex columnToCheck = 0;
+NABoolean done = FALSE;
+while (!done)
+  {
+if (columnToCheck >= index->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else if (columnToCheck >= otherIndex->getIndexKey().entries())
+  return INCOMPATIBLE;  // must be one of the indexes is just 
"_SALT_" (seems unlikely actually)
+else
+  {
+IndexColumn * indexCol = (IndexColumn 
*)(index->getIndexKey()[columnToCheck]).getItemExpr();
+IndexColumn * otherIndexCol = (IndexColumn 
*)(otherIndex->getIndexKey()[columnToCheck]).getItemExpr();
+if ( indexCol->getNAColumn()->isSaltColumn() &&
+ otherIndexCol->getNAColumn()->isSaltColumn() )
+  columnToCheck++;
+else if ( indexCol->getDefinition() != 
otherIndexCol->getDefinition() )
+  return INCOMPATIBLE;
+else
+  done = TRUE;  // leading column (ignoring "_SALT_" if both 
have "_SALT_") is different
--- End diff --

This comment is incorrect... it should read "leading column ... is the same"


---


[GitHub] incubator-trafodion pull request #1306: [TRAFODION-2813] Ignore leading salt...

2017-11-20 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2813] Ignore leading salt columns when checking index 
compatibility

See the JIRA for fix details.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2813

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

https://github.com/apache/incubator-trafodion/pull/1306.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 #1306


commit 25e64a8fa6a0c91f9451f7b6fa10e52ac03d58c3
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-11-20T23:14:29Z

[TRAFODION-2813] Ignore leading salt columns when checking index 
compatibility




---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151575553
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
+case ${YN} in
+   Y|y|Yes|YES)
+   ;;
+   *)
+   echo "Download following build tools from internet:"
+   for i in `seq ${#local_sws[@]}`
+   do
+   printf "%2d.%15s: %s\n" ${i} ${local_sws[${i}-1]} 
${http_sws[${i}-1]}
+   done
+   exit 1
+   ;;
+esac
+else
+# check the local software's source exist or not
+for local_sw in ${local_sws[@]}
+do
+   local_file=`ls ${MY_LOCAL_SW_DIST} | grep ${local_sw}`
+   if [ "x${local_file}" = "x" ]; then
+echo "WARN: [${local_sw}] source file not exist in directory 
[${MY_LOCAL_SW_DIST}]"
+   fi
+done
+fi
+
+# check the permission.
+(${MY_SUDO} touch /etc/trafpermise) >>${LOGFILE}2>&1
+if [ "x$?" != "x0" ]; then
+echo "ERROR: you must run this script with sudo without password 
permission."
+exit 1
+fi
+
+# check the based command
+basecmds=(yum lsb_release awk cut uname)
+for basecmd in ${basecmds[@]}  
+do
+basecmdpath=`which ${basecmd}`
+if [ "x$?" != "x0" ]; then
+   case ${basecmd} in
+   yum)
+   echo "ERROR: yum must install first by yourself."
+   exit 1
+   ;;
+   lsb_release)
+   (${MY_YUM} install redhat-lsb) >>${LOGFILE}2>&1
+   if [ "x$?" = "x0" ]; then
+   echo "ERROR: yum repo server has a error when run command 
[${MY_YUM} install redhat-lsb]."
+   exit 1
+   fi
+   ;;
+   *)
+   echo "ERROR: command [${basecmd}] not exist, make sure you have 
installed,and the path command added to path rightly."
+   exit 1
+   esac
+fi
+echo "INFO: command ${basecmd} exist"
+done
+
+osname=`uname -o`
+cpuarch=`uname -m`
+echo "INFO: os is [${osname}], cpu architecture is [${cpuarch}]"
+
+osdistributor=`lsb_release -i | cut -d : -f 2-`
+case ${osdistributor} in
+*RedHat*|*CentOS*)
+   echo "INFO: os distributor id is [${osdistributor}]"
+   ;;
+*)
+   echo "ERROR: os distributor is [${osdistributor}], but only support 
RedHat or CentOS now."
--- End diff --

Suggest: "ERROR: The OS distribution is [${osdistributor}], but Trafodion 
only supports RedHat and CentOS presently."


---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151575650
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
+case ${YN} in
+   Y|y|Yes|YES)
+   ;;
+   *)
+   echo "Download following build tools from internet:"
+   for i in `seq ${#local_sws[@]}`
+   do
+   printf "%2d.%15s: %s\n" ${i} ${local_sws[${i}-1]} 
${http_sws[${i}-1]}
+   done
+   exit 1
+   ;;
+esac
+else
+# check the local software's source exist or not
+for local_sw in ${local_sws[@]}
+do
+   local_file=`ls ${MY_LOCAL_SW_DIST} | grep ${local_sw}`
+   if [ "x${local_file}" = "x" ]; then
+echo "WARN: [${local_sw}] source file not exist in directory 
[${MY_LOCAL_SW_DIST}]"
+   fi
+done
+fi
+
+# check the permission.
+(${MY_SUDO} touch /etc/trafpermise) >>${LOGFILE}2>&1
+if [ "x$?" != "x0" ]; then
+echo "ERROR: you must run this script with sudo without password 
permission."
+exit 1
+fi
+
+# check the based command
+basecmds=(yum lsb_release awk cut uname)
+for basecmd in ${basecmds[@]}  
+do
+basecmdpath=`which ${basecmd}`
+if [ "x$?" != "x0" ]; then
+   case ${basecmd} in
+   yum)
+   echo "ERROR: yum must install first by yourself."
+   exit 1
+   ;;
+   lsb_release)
+   (${MY_YUM} install redhat-lsb) >>${LOGFILE}2>&1
+   if [ "x$?" = "x0" ]; then
+   echo "ERROR: yum repo server has a error when run command 
[${MY_YUM} install redhat-lsb]."
+   exit 1
+   fi
+   ;;
+   *)
+   echo "ERROR: command [${basecmd}] not exist, make sure you have 
installed,and the path command added to path rightly."
+   exit 1
+   esac
+fi
+echo "INFO: command ${basecmd} exist"
+done
+
+osname=`uname -o`
+cpuarch=`uname -m`
+echo "INFO: os is [${osname}], cpu architecture is [${cpuarch}]"
+
+osdistributor=`lsb_release -i | cut -d : -f 2-`
+case ${osdistributor} in
+*RedHat*|*CentOS*)
+   echo "INFO: os distributor id is [${osdistributor}]"
+   ;;
+*)

[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151574464
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
--- End diff --

This file needs an Apache license header. (This is why the static checks 
are failing.)


---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151575282
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
+case ${YN} in
+   Y|y|Yes|YES)
+   ;;
+   *)
+   echo "Download following build tools from internet:"
+   for i in `seq ${#local_sws[@]}`
+   do
+   printf "%2d.%15s: %s\n" ${i} ${local_sws[${i}-1]} 
${http_sws[${i}-1]}
+   done
+   exit 1
+   ;;
+esac
+else
+# check the local software's source exist or not
+for local_sw in ${local_sws[@]}
+do
+   local_file=`ls ${MY_LOCAL_SW_DIST} | grep ${local_sw}`
+   if [ "x${local_file}" = "x" ]; then
+echo "WARN: [${local_sw}] source file not exist in directory 
[${MY_LOCAL_SW_DIST}]"
+   fi
+done
+fi
+
+# check the permission.
+(${MY_SUDO} touch /etc/trafpermise) >>${LOGFILE}2>&1
+if [ "x$?" != "x0" ]; then
+echo "ERROR: you must run this script with sudo without password 
permission."
+exit 1
+fi
+
+# check the based command
+basecmds=(yum lsb_release awk cut uname)
+for basecmd in ${basecmds[@]}  
+do
+basecmdpath=`which ${basecmd}`
+if [ "x$?" != "x0" ]; then
+   case ${basecmd} in
+   yum)
+   echo "ERROR: yum must install first by yourself."
--- End diff --

Do you mean, "ERROR: You must first install yum"?


---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151575051
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
+case ${YN} in
+   Y|y|Yes|YES)
+   ;;
+   *)
+   echo "Download following build tools from internet:"
+   for i in `seq ${#local_sws[@]}`
+   do
+   printf "%2d.%15s: %s\n" ${i} ${local_sws[${i}-1]} 
${http_sws[${i}-1]}
+   done
+   exit 1
+   ;;
+esac
+else
+# check the local software's source exist or not
+for local_sw in ${local_sws[@]}
+do
+   local_file=`ls ${MY_LOCAL_SW_DIST} | grep ${local_sw}`
+   if [ "x${local_file}" = "x" ]; then
+echo "WARN: [${local_sw}] source file not exist in directory 
[${MY_LOCAL_SW_DIST}]"
--- End diff --

Suggested wordsmith: "WARNING: [${local_sw}] source file does not exist in 
directory [${MY_LOCAL_SW_DIST}]"


---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151575418
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
+case ${YN} in
+   Y|y|Yes|YES)
+   ;;
+   *)
+   echo "Download following build tools from internet:"
+   for i in `seq ${#local_sws[@]}`
+   do
+   printf "%2d.%15s: %s\n" ${i} ${local_sws[${i}-1]} 
${http_sws[${i}-1]}
+   done
+   exit 1
+   ;;
+esac
+else
+# check the local software's source exist or not
+for local_sw in ${local_sws[@]}
+do
+   local_file=`ls ${MY_LOCAL_SW_DIST} | grep ${local_sw}`
+   if [ "x${local_file}" = "x" ]; then
+echo "WARN: [${local_sw}] source file not exist in directory 
[${MY_LOCAL_SW_DIST}]"
+   fi
+done
+fi
+
+# check the permission.
+(${MY_SUDO} touch /etc/trafpermise) >>${LOGFILE}2>&1
+if [ "x$?" != "x0" ]; then
+echo "ERROR: you must run this script with sudo without password 
permission."
+exit 1
+fi
+
+# check the based command
+basecmds=(yum lsb_release awk cut uname)
+for basecmd in ${basecmds[@]}  
+do
+basecmdpath=`which ${basecmd}`
+if [ "x$?" != "x0" ]; then
+   case ${basecmd} in
+   yum)
+   echo "ERROR: yum must install first by yourself."
+   exit 1
+   ;;
+   lsb_release)
+   (${MY_YUM} install redhat-lsb) >>${LOGFILE}2>&1
+   if [ "x$?" = "x0" ]; then
+   echo "ERROR: yum repo server has a error when run command 
[${MY_YUM} install redhat-lsb]."
+   exit 1
+   fi
+   ;;
+   *)
+   echo "ERROR: command [${basecmd}] not exist, make sure you have 
installed,and the path command added to path rightly."
--- End diff --

Suggest: "ERROR: command [${basecmd}] does not exist. Make sure you have 
installed it, and have added it to the command path."


---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151574935
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
+case ${YN} in
+   Y|y|Yes|YES)
+   ;;
+   *)
+   echo "Download following build tools from internet:"
--- End diff --

Suggested wordsmith: "Downloading the following build tools from the 
internet:"


---


[GitHub] incubator-trafodion pull request #1296: [TRAFODION-2802] fix this problem

2017-11-16 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1296#discussion_r151574846
  
--- Diff: install/traf_checkset_env.sh ---
@@ -0,0 +1,186 @@
+#!/bin/bash
+#
+# make sure the environment can build the code of trafodion or not.
+# must configure the yum repo right before execute this script.
+# run this script with normal user, while must has sudo permission.
+
+#default path
+MY_JVM_PATH=${MY_JVM_PATH-"/usr/lib/jvm"}
+MY_JAVA_VER=${MY_JAVA_VER-"java-1.7.0-openjdk"}
+MY_SUDO=${MY_SUDO-"sudo"}
+MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}
+
+# for setup tools
+MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
+MY_INSTALL_SW_DIST=${MY_INSTALL_SW_DIST-${HOME}/installed_software_tools}
+MY_DOWNLOAD_SW_DIST=${MY_DOWNLOAD_SW_DIST-${HOME}/download_software_tools}
+
+CHECKLOG=${LOGFILE-$(pwd)/$0.log}
+local_sws=(udis llvm mpich bison icu zookeeper thrift apache-maven 
protobuf apache-log4cxx hadoop)
+http_sws=(
+http://sourceforge.net/projects/udis86/files/udis86/1.7/udis86-1.7.2.tar.gz
+http://llvm.org/releases/3.2/llvm-3.2.src.tar.gz
+http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
+http://ftp.gnu.org/gnu/bison/bison-3.0.tar.gz
+http://download.icu-project.org/files/icu4c/4.4/icu4c-4_4-src.tgz

+https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
+http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz

+http://archive.apache.org/dist/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz

+https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz

+https://dist.apache.org/repos/dist/release/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

+http://archive.apache.org/dist/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
+)
+
+# check the local software directory
+if [ ! -d ${MY_LOCAL_SW_DIST} ]; then
+echo "WARN: local sofrware tools aren't exist, should be downloading 
all
+software tools from internet, it's very slowlly! While you can
+prepare local software, and set environment MY_LOCAL_SW_DIST to
+change default software path, and run this script again. The 
+default local software directory is [${MY_LOCAL_SW_DIST}]. You
+can set environment MY_LOCAL_SW_DIST to change it."
+echo "Do you want continue? Enter y/n (default:n):"
+read YN
--- End diff --

Suggested wordsmithing: "WARNING: Local software tools aren't present. Will 
download all tools from the internet. This will be very slow. If you do have 
the local software tools present, set the environment variable MY_LOCAL_SW_DIST 
to point to them and run this script again. The default local software 
directory is [${MY_LOCAL_SW_DIST}]. Do you want to continue? Enter y/n 
(default: n):"


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150693464
  
--- Diff: core/sql/sqlcomp/CmpDescribe.cpp ---
@@ -4129,6 +4280,37 @@ char buf[1000];
((CmpCommon::getDefault(SHOWDDL_DISPLAY_PRIVILEGE_GRANTS) == 
DF_SYSTEM)
&& getenv("SQLMX_REGRESS"))) ? FALSE : TRUE;
 
+//display library comment
+   if (libraryUID > 0)
+   {
+ if (cmpSBD.switchCompiler())
+   {
+ *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_PRIVS);
+ return -1;
+   }
+
+ ComTdbVirtObjCommentInfo objCommentInfo;
+ if (cmpSBD.getSeabaseObjectComment(libraryUID, COM_LIBRARY_OBJECT, 
objCommentInfo, heap))
+   {
+ *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+ return -1;
--- End diff --

Switch back compiler here?


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150690560
  
--- Diff: core/sql/common/ComSmallDefs.h ---
@@ -660,7 +662,9 @@ enum ComTextType {COM_VIEW_TEXT = 0,
   COM_HBASE_COL_FAMILY_TEXT = 5,
   COM_HBASE_SPLIT_TEXT = 6,
   COM_STORED_DESC_TEXT = 7,
-  COM_VIEW_REF_COLS_TEXT = 8
+  COM_VIEW_REF_COLS_TEXT = 8,
+  COM_OBJET_COMMENT_TEXT = COM_TABLE_COMMENT_TEXT,
--- End diff --

Did you mean, COM_OBJECT_COMMENT_TEXT?


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150693110
  
--- Diff: core/sql/sqlcomp/CmpDescribe.cpp ---
@@ -3059,6 +3061,54 @@ short CmpDescribeSeabaseTable (
 
   outputLongLine(*space, viewtext, 0);
 
+  //display comment for VIEW
+  if (objectUID > 0)
+{
+  if (cmpSBD.switchCompiler())
+{
+  *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+  return -1;
+}
+
+  ComTdbVirtObjCommentInfo objCommentInfo;
+  if (cmpSBD.getSeabaseObjectComment(objectUID, COM_VIEW_OBJECT, 
objCommentInfo, heap))
+{
+  *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+  return -1;
--- End diff --

Should we switch the compiler back when going through this error path?


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150694388
  
--- Diff: core/sql/sqlcomp/CmpSeabaseDDLschema.cpp ---
@@ -445,14 +445,39 @@ Int16 status = 
ComUser::getAuthNameFromAuthID(objectOwner,username,
output += catalogName.data();
output += "\".\"";
output += schemaName.data();
-   
+
 // AUTHORIZATION clause is rarely used, but include it for replay.
output += "\" AUTHORIZATION \"";
output += username;
output += "\";";

outlines.push_back(output.data());
 
+   // Display Comment of schema
+{
+  ComTdbVirtObjCommentInfo objCommentInfo;
+  if (cmpSBD.getSeabaseObjectComment(schemaUID, objectType, 
objCommentInfo, STMTHEAP))
+{
+  *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+  return -1;
--- End diff --

Switch back compiler here?


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150693531
  
--- Diff: core/sql/sqlcomp/CmpDescribe.cpp ---
@@ -4634,12 +4816,49 @@ short CmpDescribeRoutine (const CorrName   & cn,
 
   outputShortLine (*space, "  ;");
 
+  CmpSeabaseDDL cmpSBD((NAHeap*)heap);
+
   char * sqlmxRegr = getenv("SQLMX_REGRESS");
   NABoolean displayPrivilegeGrants = TRUE;
   if (((CmpCommon::getDefault(SHOWDDL_DISPLAY_PRIVILEGE_GRANTS) == 
DF_SYSTEM) && sqlmxRegr) ||
(CmpCommon::getDefault(SHOWDDL_DISPLAY_PRIVILEGE_GRANTS) == DF_OFF))
 displayPrivilegeGrants = FALSE;
 
+  //display comment of routine
+  Int64 routineUID = routine->getRoutineID();
+  if ( routineUID > 0)
+{
+  if (cmpSBD.switchCompiler())
+  {
+ *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_PRIVS);
+ return -1;
+  }
+
+  ComTdbVirtObjCommentInfo objCommentInfo;
+  if (cmpSBD.getSeabaseObjectComment(routineUID, 
COM_USER_DEFINED_ROUTINE_OBJECT, objCommentInfo, heap))
+{
+  *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+  return -1;
--- End diff --

Switch back compiler here?


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150693272
  
--- Diff: core/sql/sqlcomp/CmpDescribe.cpp ---
@@ -3777,6 +3826,76 @@ short CmpDescribeSeabaseTable (
 }
 }
 
+  //display comments
+  if (type == 2 && objectUID > 0)
+{
+  enum ComObjectType objType = COM_BASE_TABLE_OBJECT;
+
+  if (isView)
+{
+  objType = COM_VIEW_OBJECT;
+}
+
+  if (cmpSBD.switchCompiler())
+{
+  *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+  return -1;
+}
+ 
+  ComTdbVirtObjCommentInfo objCommentInfo;
+  if (cmpSBD.getSeabaseObjectComment(objectUID, objType, 
objCommentInfo, heap))
+{
+  *CmpCommon::diags() << 
DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_COMMENTS);
+  return -1;
--- End diff --

Should we switch back compiler if we go through this error path?


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150693830
  
--- Diff: core/sql/sqlcomp/CmpSeabaseDDLcommentOn.cpp ---
@@ -0,0 +1,349 @@
+/**
+// @@@ 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 @@@
+**/
+
+/* -*-C++-*-
+ 
*
+ *
+ * File: CmpSeabaseDDLcommentOn.cpp
+ * Description:  Implements ddl operations for Seabase indexes.
+ *
+ *
+ * Created: 8/17/2017
+ * Language: C++
+ *
+ *
+ 
*
+ */
+
+#define   SQLPARSERGLOBALS_FLAGS   // must precede all #include's
+#define   SQLPARSERGLOBALS_NADEFAULTS
+
+#include "ComObjectName.h"
+
+#include "CmpDDLCatErrorCodes.h"
+#include "ElemDDLHbaseOptions.h"
+
+#include "SchemaDB.h"
+#include "CmpSeabaseDDL.h"
+#include "CmpDescribe.h"
+
+#include "ExpHbaseInterface.h"
+
+#include "ExExeUtilCli.h"
+#include "Generator.h"
+
+#include "ComCextdecs.h"
+#include "ComUser.h"
+
+#include "NumericType.h"
+
+#include "PrivMgrCommands.h"
+
+#include "StmtDDLCommentOn.h"
+
+#include "PrivMgrComponentPrivileges.h"
+#include "PrivMgrCommands.h"
+#include "ComUser.h"
+
+
+short CmpSeabaseDDL::getSeabaseObjectComment(Int64 object_uid, 
+enum ComObjectType 
object_type, 
+
ComTdbVirtObjCommentInfo & comment_info,
+CollHeap * heap)
+{
+  Lng32 retcode = 0;
+  Lng32 cliRC = 0;
+
+  char query[4000];
+
+  comment_info.objectUid = object_uid;
+  comment_info.objectComment = NULL;
+  comment_info.numColumnComment = 0;
+  comment_info.columnCommentArray = NULL;
+  comment_info.numIndexComment = 0;
+  comment_info.indexCommentArray = NULL;
+
+  ExeCliInterface cliInterface(STMTHEAP, NULL, NULL, 
+   
CmpCommon::context()->sqlSession()->getParentQid());
+
+  //get object comment
+  sprintf(query, "select TEXT from %s.\"%s\".%s where TEXT_UID = %ld and 
TEXT_TYPE = %d and SUB_ID = %d ; ",
--- End diff --

Ah, you decided to keep the comment text in the TEXT table. That's a good 
idea; you don't need to add columns to OBJECTS or COLUMNS that way, reducing 
the work for metadata upgrade.


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150691328
  
--- Diff: core/sql/parser/StmtDDLCommentOn.h ---
@@ -0,0 +1,153 @@
+/**
+// @@@ 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 @@@
+**/
+#ifndef STMTDDLCOMMENTON_H
+#define STMTDDLCOMMENTON_H
+/* -*-C++-*-
+ 
*
+ *
+ * File: StmtDDLCommentOn.h
+ * Description:  class for Comment On Statement (parser node)
+ *
+ *
+ * Created:  8/2/17
+ * Language: C++
+ *
+ *
+ *
+ *
+ 
*
+ */
+
+#include "ComSmallDefs.h"
+#include "StmtDDLNode.h"
+
+
+
+// ---
+// forward references
+// ---
+// None
+
+// ---
+// Comment On statement
+// ---
+class StmtDDLCommentOn : public StmtDDLNode
+{
+  
+public:
+
+  enum COMMENT_ON_TYPES {
+COMMENT_ON_TYPE_TABLE = 10,
--- End diff --

I am curious: why do we start at 10? Is there another enum that this one 
has to co-exist with? If so, would be good to mention that in a comment here 
(in case the other enum expands some day).


---


[GitHub] incubator-trafodion pull request #1288: New COMMENT-ON SQL statement

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1288#discussion_r150692372
  
--- Diff: core/sql/parser/sqlparser.y ---
@@ -33167,7 +33173,106 @@ stats_merge_clause : /*empty */
{ $$ = SQLCLI_PROGRESS_STATS; }
  | TOK_DEFAULT
{ $$ = SQLCLI_SAME_STATS; }  
-   
+
+
+/* type pStmtDDL */
+comment_on_statement : TOK_COMMENT TOK_ON comment_on_object_types 
ddl_qualified_name TOK_IS QUOTED_STRING
+   {
+ StmtDDLCommentOn *pNode = 
+   new(PARSERHEAP()) StmtDDLCommentOn(
+ $3,
+ *$4,
+ *$6,
+ PARSERHEAP()
+   );
+
+ $$ = pNode;
+   }
+ | TOK_COMMENT TOK_ON TOK_SCHEMA schema_name TOK_IS 
QUOTED_STRING
+   {
+ // EJF L4J - CQD dynamic are not allowed in Compound 
Statements
--- End diff --

The comment is incorrect. But was it your intent to disallow COMMENT ON 
within a compound statement? If so, you may want to disallow it in the first 
TOK_COMMENT production as well.


---


[GitHub] incubator-trafodion pull request #1298: [TRAFODION-2799] Fix transactions de...

2017-11-13 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2799] Fix transactions description in Trafodion Arch Overview



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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2799

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

https://github.com/apache/incubator-trafodion/pull/1298.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 #1298






---


[GitHub] incubator-trafodion pull request #1295: [TRAFODION-2794] Add *DIVISION BY (C...

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1295#discussion_r150682629
  
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc ---
@@ -2816,6 +2817,38 @@ Considerations for LOAD IF EXISTS and NO LOAD 
options of CREATE TABLE AS>>.
 +
 specifies a select query which is used to populate the created table. A 
select query can be any SQL select statement.
 
+* `_division-expr-list_`
++
+is a list of expressions that can only refer to primary key or STORE BY 
columns.
+
++
+The followings are allowed expressions in the DIVISON BY clause, they are 
monotonically increasing expressions:
--- End diff --

Grammar. Should be "The following are ..."


---


[GitHub] incubator-trafodion pull request #1295: [TRAFODION-2794] Add *DIVISION BY (C...

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1295#discussion_r150683181
  
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc ---
@@ -3308,6 +3343,43 @@ SELECT * FROM T WHERE b = 'A';
 SELECT * FROM T WHERE b = 'A' (not casespecific);
 ```
 
+* This is the 1^st^ example of DIVISION BY usage.
++
+```
+CREATE TABLE call_home_data
+(id LARGEINT NOT NULL,
+ts TIMESTAMP(6) NOT NULL,
+device_status VARCHAR(200),
+PRIMARY KEY (id, ts))
+SALT USING 16 PARTITIONS ON (id)
+DIVISION BY (date_trunc('day', ts));
+```
+
+* This is the 2^nd^ example of DIVISION BY usage.
++
+```
+CREATE TABLE sales1
+(store_id INT NOT NULL,
+item_id  INT NOT NULL,
+sale_date DATE DEFAULT DATE '2000-01-01' NOT NULL,
+sale_amt NUMERIC(10,2),
+PRIMARY KEY (store_id, item_id, sale_date))
+DIVISION BY (DATEDIFF(YEAR, '2017-11-02', sale_date));
+```
+
+* This is the 3^rd^ example of DIVISION BY usage.
--- End diff --

Consider spelling out "third". By the way, many style guides suggest 
spelling out the ordinals "first", "second", ... "tenth", then using the 
abbreviated form 11^th^ and so on for larger numbers.


---


[GitHub] incubator-trafodion pull request #1295: [TRAFODION-2794] Add *DIVISION BY (C...

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1295#discussion_r150682876
  
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc ---
@@ -3308,6 +3343,43 @@ SELECT * FROM T WHERE b = 'A';
 SELECT * FROM T WHERE b = 'A' (not casespecific);
 ```
 
+* This is the 1^st^ example of DIVISION BY usage.
--- End diff --

I suggest spelling out "first" rather than using 1^st^


---


[GitHub] incubator-trafodion pull request #1295: [TRAFODION-2794] Add *DIVISION BY (C...

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1295#discussion_r150682416
  
--- Diff: 
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -2573,7 +2573,7 @@ DATE_PART('year', date'12/05/2006')
 DATE_PART('day', TIMESTAMP '2006-12-31 11:59:59.99')
 ```
 
-* This function returns the value 201 07.
+* This function returns the value 2011 07.
--- End diff --

Just tried this. Looks like it returns 201107 (no space between the 2011 
and the 07).


---


[GitHub] incubator-trafodion pull request #1295: [TRAFODION-2794] Add *DIVISION BY (C...

2017-11-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1295#discussion_r150682981
  
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_statements.adoc ---
@@ -3308,6 +3343,43 @@ SELECT * FROM T WHERE b = 'A';
 SELECT * FROM T WHERE b = 'A' (not casespecific);
 ```
 
+* This is the 1^st^ example of DIVISION BY usage.
++
+```
+CREATE TABLE call_home_data
+(id LARGEINT NOT NULL,
+ts TIMESTAMP(6) NOT NULL,
+device_status VARCHAR(200),
+PRIMARY KEY (id, ts))
+SALT USING 16 PARTITIONS ON (id)
+DIVISION BY (date_trunc('day', ts));
+```
+
+* This is the 2^nd^ example of DIVISION BY usage.
--- End diff --

Consider spelling out "second"


---


[GitHub] incubator-trafodion pull request #1277: [TRAFODION-2783] jdbc_test_cdh fails...

2017-10-26 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1277#discussion_r147227161
  
--- Diff: core/sql/common/charinfo.h ---
@@ -260,11 +260,14 @@ class CharInfo
  Int32   sourceLenInBytes,
  CharSet targetCS);
 
+  static void initBuiltinCollationDB();
+ 
+
 private:
 friend class CollationDB;  // needs to access builtinCDB_
 
static const char*  const localeCharSet_;
-   static const CollationDB   builtinCollationDB_;
+   static const CollationDB   *builtinCollationDB_;
--- End diff --

Oh, sorry; this is the declaration rather than the definition. Ignore my 
comment.


---


[GitHub] incubator-trafodion pull request #1277: [TRAFODION-2783] jdbc_test_cdh fails...

2017-10-26 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1277#discussion_r147223503
  
--- Diff: core/sql/common/charinfo.cpp ---
@@ -363,21 +363,22 @@ void CollationInfo::display() const
 CollationDB::CollationDB(CollHeap *h)
   : CollationDBSupertype(h), heap_(h), refreshNeeded_(TRUE)
 {
-if (this == ::builtinCollationDB_) return;
+if (this == CharInfo::builtinCollationDB_) return;
--- End diff --

I'm confused. Is CollationDB a singleton object? Or is there one global 
version, and other parts of the code might create their own version?


---


[GitHub] incubator-trafodion pull request #1277: [TRAFODION-2783] jdbc_test_cdh fails...

2017-10-26 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1277#discussion_r147223670
  
--- Diff: core/sql/common/charinfo.cpp ---
@@ -529,8 +530,10 @@ static const CollationInfo mapCOArray[] = {
   CollationInfo(NULL, CharInfo::UNKNOWN_COLLATION,  
SQLCOLLATIONSTRING_UNKNOWN,
STATIC_NEG)
 };
-static const size_t SIZEOF_CO = sizeof(mapCOArray)/sizeof(CollationInfo);
-const CollationDB CharInfo::builtinCollationDB_(NULL, mapCOArray, 
SIZEOF_CO);
+
+#define SIZEOF_CO (sizeof(mapCOArray)/sizeof(CollationInfo))
+
+const CollationDB *CharInfo::builtinCollationDB_;
--- End diff --

Suggest initializing this global pointer to null, so you get better 
behavior in race conditions.


---


[GitHub] incubator-trafodion pull request #1277: [TRAFODION-2783] jdbc_test_cdh fails...

2017-10-26 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1277#discussion_r147222686
  
--- Diff: core/sql/common/charinfo.h ---
@@ -260,11 +260,14 @@ class CharInfo
  Int32   sourceLenInBytes,
  CharSet targetCS);
 
+  static void initBuiltinCollationDB();
+ 
+
 private:
 friend class CollationDB;  // needs to access builtinCDB_
 
static const char*  const localeCharSet_;
-   static const CollationDB   builtinCollationDB_;
+   static const CollationDB   *builtinCollationDB_;
--- End diff --

Suggest initializing to NULL. So if you get a thread race condition, you'll 
get better behavior if one thread accessing this pointer beats the other thread 
that is initializing it.


---


[GitHub] incubator-trafodion pull request #1277: [TRAFODION-2783] jdbc_test_cdh fails...

2017-10-26 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1277#discussion_r147223897
  
--- Diff: core/sql/common/charinfo.cpp ---
@@ -693,3 +696,9 @@ Int32 CharInfo::getMaxConvertedLenInBytes(CharSet 
sourceCS,
   return ((sourceLenInBytes/minBytesPerChar(sourceCS)) *
   maxBytesPerChar(targetCS));
 }
+
+void CharInfo::initBuiltinCollationDB()
+{
+   builtinCollationDB_ = new CollationDB(NULL, mapCOArray, SIZEOF_CO);
--- End diff --

Is mapCOArray another global object? If it is const it is OK. If not, how 
do we know that it has been constructed already?


---


[GitHub] incubator-trafodion pull request #1269: Fix latent bug unmasked by JIRA TRAF...

2017-10-18 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

Fix latent bug unmasked by JIRA TRAFODION-2765 fix

This fix comments out some code that now causes non-determinstic failures 
in test compGeneral/TEST006. The essence of the bug is that queries against 
tables lacking statistics would non-deterministically flip to MDAM. The 
commented-out code contains several issues; rather than fixing them it seems 
more efficient to simply continue with the MDAM costing code rewrite which is 
occurring under JIRA TRAFODION-2645.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2777

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

https://github.com/apache/incubator-trafodion/pull/1269.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 #1269


commit 682c48e260d6bde50b13bf40567c9353e3b3dcda
Author: Dave Birdsall <dave.birds...@esgyn.com>
Date:   2017-10-18T21:45:04Z

Rework to address compGeneral/TEST006 failure
(cherry picked from commit 6320b901b6f123da9697dc8a898785168958dc10)




---


[GitHub] incubator-trafodion pull request #1267: [TRAFODION-2775] Insert does not rai...

2017-10-18 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1267#discussion_r145479903
  
--- Diff: core/sql/exp/ExpHbaseInterface.cpp ---
@@ -842,7 +842,9 @@ Lng32 ExpHbaseInterface_JNI::insertRow(
 transID = getTransactionIDFromContext();
   retCode_ = client_->insertRow((NAHeap *)heap_, tblName.val, hbs_,
 useTRex_, transID, rowID, row, timestamp, 
-checkAndPut, asyncOperation, useRegionXn, 
);
+checkAndPut, asyncOperation, useRegionXn, 
+   0, // checkAndPut is false, so colIndexToCheck 
is not used
--- End diff --

How will the insertRow method distinguish between the "not used" case and a 
column index of zero? (Elsewhere I saw a comment that the column index is 
0-based.)


---


[GitHub] incubator-trafodion pull request #1266: [TRAFODION-2771] Fix lob_guide/pom_x...

2017-10-16 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2771] Fix lob_guide/pom_xml to copy LOB guide to right place

The last pull request for this JIRA copied the LOB Guide to the 
sql_reference directory, overwriting the SQL Reference Manual. This one copies 
it to the right place on the web site.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2771

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

https://github.com/apache/incubator-trafodion/pull/1266.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 #1266


commit 870b9df3104221e08dfdf43b318b8a732f42110f
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-10-16T16:49:56Z

[TRAFODION-2771] Fix lob_guide/pom_xml to copy LOB guide to correct place




---


[GitHub] incubator-trafodion pull request #1264: [TRAFODION-2772] - retrieve a value ...

2017-10-13 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1264#discussion_r144664852
  
--- Diff: core/sql/exp/exp_function.cpp ---
@@ -6503,8 +6503,19 @@ ex_expr::exp_return_type 
ex_function_json_object_field_text::eval(char *op_data[
 Int32 prec2 = ((SimpleType *)getOperand(2))->getPrecision();
 len2 = Attributes::trimFillerSpaces( op_data[2], prec2, len2, cs );
 }
+
 char *rltStr = NULL;
-JsonReturnType ret = json_extract_path_text(, op_data[1], 1, 
op_data[2]);
+char *jsonStr = new(heap) char[len1+1];
+char *jsonAttr = new(heap) char[len2+1];
+if (jsonStr == NULL || jsonAttr == NULL)
+{
+return ex_expr::EXPR_ERROR;
--- End diff --

We should add something to the diagnostic area when making this return. 
Though I expect that might fail with a memory error as well. Might be 
worthwhile to see how other functions behave when memory allocations fail.


---


[GitHub] incubator-trafodion pull request #1262: TRAFODION-2731 CodeCleanup: Phase 5....

2017-10-11 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1262#discussion_r144143206
  
--- Diff: core/sql/common/Ipc.cpp ---
@@ -4580,44 +4565,21 @@ IpcServerClass::IpcServerClass(IpcEnvironment *env,
   }
   if (allocationMethod_ == IPC_ALLOC_DONT_CARE)
 {
-#if (defined(NA_GUARDIAN_IPC))
- // NA_WINNT is set and NA_GUARDIAN_IPC is set
- // The standard method on NT is to create a Guardian process
- // in order to run in an NT only or simulated environment we can set 
an environment
- // variable to override that mechanism.
- if (getenv("SQL_NO_NSK_LITE") == NULL)
- {
-  allocationMethod_ = IPC_LAUNCH_GUARDIAN_PROCESS;
- }
- else 
- {
-  allocationMethod_ = IPC_LAUNCH_NT_PROCESS;
-  time_t tp;
-  time();
- nextPort_ = IPC_SQLESP_PORTNUMBER + tp % 1; // arbitrary
- };
-
-#else // NA_GUARDIAN_IPC
-
- // NA_WINNT is set and NA_GUARDIAN_IPC is NOT set
- // The standard method on NT is to create an NT process
- // We use socket based communication but launch the process ourself 
rather
- // than using INETD.
- // Eventually we will use nsk lite to create new processes and to
- // communicate via the message system.
- // in order to run in an NT only or simulated environment we can set 
an environment
- // variable to override that mechanism.
- if (getenv("SQL_NO_NSK_LITE") == NULL)
- {allocationMethod_ = IPC_LAUNCH_GUARDIAN_PROCESS;
- }
- else 
- {
- allocationMethod_ = IPC_LAUNCH_NT_PROCESS;
+  // NA_WINNT is set and NA_GUARDIAN_IPC is set
+  // The standard method on NT is to create a Guardian process
+  // in order to run in an NT only or simulated environment we can set 
an environment
+  // variable to override that mechanism.
+  if (getenv("SQL_NO_NSK_LITE") == NULL)
--- End diff --

Do we want to keep the NT code?


---


[GitHub] incubator-trafodion pull request #1262: TRAFODION-2731 CodeCleanup: Phase 5....

2017-10-11 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1262#discussion_r144143139
  
--- Diff: core/sql/common/Ipc.cpp ---
@@ -4580,44 +4565,21 @@ IpcServerClass::IpcServerClass(IpcEnvironment *env,
   }
   if (allocationMethod_ == IPC_ALLOC_DONT_CARE)
 {
-#if (defined(NA_GUARDIAN_IPC))
- // NA_WINNT is set and NA_GUARDIAN_IPC is set
- // The standard method on NT is to create a Guardian process
- // in order to run in an NT only or simulated environment we can set 
an environment
- // variable to override that mechanism.
- if (getenv("SQL_NO_NSK_LITE") == NULL)
- {
-  allocationMethod_ = IPC_LAUNCH_GUARDIAN_PROCESS;
- }
- else 
- {
-  allocationMethod_ = IPC_LAUNCH_NT_PROCESS;
-  time_t tp;
-  time();
- nextPort_ = IPC_SQLESP_PORTNUMBER + tp % 1; // arbitrary
- };
-
-#else // NA_GUARDIAN_IPC
-
- // NA_WINNT is set and NA_GUARDIAN_IPC is NOT set
- // The standard method on NT is to create an NT process
- // We use socket based communication but launch the process ourself 
rather
- // than using INETD.
- // Eventually we will use nsk lite to create new processes and to
- // communicate via the message system.
- // in order to run in an NT only or simulated environment we can set 
an environment
- // variable to override that mechanism.
- if (getenv("SQL_NO_NSK_LITE") == NULL)
- {allocationMethod_ = IPC_LAUNCH_GUARDIAN_PROCESS;
- }
- else 
- {
- allocationMethod_ = IPC_LAUNCH_NT_PROCESS;
+  // NA_WINNT is set and NA_GUARDIAN_IPC is set
--- End diff --

Perhaps delete this one line of the comment since the defines are no longer 
used?


---


[GitHub] incubator-trafodion pull request #1263: [TRAFODION-2771] Add build step and ...

2017-10-11 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2771] Add build step and web site link for Trafodion LOB Guide

These changes do the following:

1. Add an entry to the top-level pom.xml file so that the new Trafodion LOB 
Guide will get built as part of the documentation build (mvn post-site step).

2. Add an entry to the documentation.md file so that links to the new Guide 
will appear on the Trafodion documentation web page.

3. Change the lob_guide/pom.xml file to provide an appropriate name for the 
pdf file for the LOB Guide.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2771

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

https://github.com/apache/incubator-trafodion/pull/1263.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 #1263


commit a8d82b743746d1f2e3f6455ecefc1bbc9ba22622
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-10-11T21:16:54Z

[TRAFODION-2771] Add build step and web site link for Trafodion LOB Guide




---


[GitHub] incubator-trafodion pull request #1261: [TRAFODION-1715] Improve memory use ...

2017-10-10 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-1715] Improve memory use in UPDATE STATS when sample table…

… is used

UPDATE STATISTICS allocates memory for columns before deciding whether to 
create and populate a sample table. (It may turn out that creating one is 
unnecessary.)

This change deallocates that memory when a sample table is created and 
populated, improving the amount of memory available for the latter. The memory 
is reallocated again once the sample table is populated.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion1715

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

https://github.com/apache/incubator-trafodion/pull/1261.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 #1261


commit 2d2643c5c9fe93448f454554195cb23c5ebc79b9
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-10-10T19:29:50Z

[TRAFODION-1715] Improve memory use in UPDATE STATS when sample table is 
used




---


[GitHub] incubator-trafodion pull request #1260: [TRAFODION-2768] Make Trafodion code...

2017-10-10 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1260#discussion_r143764664
  
--- Diff: core/sqf/src/tm/tm.cpp ---
@@ -460,9 +460,13 @@ void tm_process_req_requestregioninfo(CTmTxMessage * 
pp_msg)
TM_Txid_legacy lv_transid;
} u;
 
-   char tname[2000], ername[50], rname[100], offline[20], regid[200], 
hostname[200], port[100];
+   char tname[2000];
+   tname[299] = '\0';
--- End diff --

Odd that we'd set just element 299 of a 2000-byte buffer to null. But I see 
that this is the way it was before.


---


[GitHub] incubator-trafodion pull request #1258: [TRAFODION-2765] Change heuristics s...

2017-10-05 Thread DaveBirdsall
GitHub user DaveBirdsall opened a pull request:

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

[TRAFODION-2765] Change heuristics so MDAM is considered more often

This change adds new heuristic code to 
ScanOptimizer::useSimpleFileScanOptimizer (optimizer/ScanOptimizer.cpp). The 
new code checks to see if a single subset scan uses all the key predicates in 
the query. If so, we don't bother to cost MDAM. But if not, we do consider MDAM.

The old code contained some (probably unintended) odd heuristics. Given a 
salted table with keys A, B and C, and a query SELECT * FROM T WHERE A = 5 AND 
C = 20, the old code would consider MDAM for serial plans but not for parallel 
ones! This is because in the serial case, a single subset would be a full table 
scan (so it is quite reasonable to try MDAM), but in the parallel case, because 
the "_SALT_" column would be covered by an equality predicate, the single 
subset SearchKey would have equality predicates on a prefix of the key. It 
would assume that a single subset with equality on "_SALT_" and A was always 
better than considering MDAM to column C. However, if the UEC of B is low, and 
the UEC of C is high, using MDAM to column C can be quite efficient. The new 
heuristics will allow this possibility to be explored.

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

$ git pull https://github.com/DaveBirdsall/incubator-trafodion Trafodion2765

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

https://github.com/apache/incubator-trafodion/pull/1258.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 #1258


commit 3b71aeb6f26389f862536903ff4156d55fa3aca5
Author: Dave Birdsall <dbirds...@apache.org>
Date:   2017-10-05T22:10:11Z

[TRAFODION-2765] Change heuristics so MDAM is considered more often




---


[GitHub] incubator-trafodion pull request #1253: [TRAFODION-1610][TRAFODION-2630] Gen...

2017-10-04 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1253#discussion_r142806685
  
--- Diff: core/sql/generator/GenRelUpdate.cpp ---
@@ -1718,19 +1806,56 @@ short HbaseUpdate::codeGen(Generator * generator)
 }
   else if (getIndexDesc()->isClusteringIndex() && 
getCheckConstraints().entries())
 {
-  GenAssert(FALSE, "Should not reach here. This update should have 
been transformed to delete/insert");
-  // To be uncommented when TRAFODION-1610 is implemented
-  // Need to generate insConstraintExpr also
-/*
+  // Generate the update and insert constraint check expressions
+
+  // The attributes for the columns referenced in the constraint 
expressions
+  // refer to the source values of the columns. We want to evaluate the
+  // constraints aganst the target values, though. So, there is some
+  // Attributes gymnastics that has to happen to generate them.
+
+  // Obtain the ValueIds of base table columns referenced in the
+  // constraints
+
+  ValueId constraintId;
+  ValueIdSet constraintColumns;
+  for (CollIndex ci = 0; ci < getCheckConstraints().entries(); ci++)
+{
+  constraintId = getCheckConstraints()[ci];
+  constraintId.getItemExpr()->findAll(ITM_INDEXCOLUMN,
+  constraintColumns, // out, 
has append semantics
+  TRUE, // visitVEGmembers
+  FALSE); // don't visit index 
descriptors
+}
+
+  // Prepare the constraint tree for generation
+
   ItemExpr *constrTree =
 getCheckConstraints().rebuildExprTree(ITM_AND, TRUE, TRUE);
 
   if (getTableDesc()->getNATable()->hasSerializedEncodedColumn())
-constrTree = generator->addCompDecodeForDerialization(constrTree);
+constrTree = generator->addCompDecodeForDerialization(constrTree, 
isAlignedFormat);
+
+  // Generate the update constraint expression, substituting 
Attributes for
+  // the new update record
+
+  genUpdConstraintExpr(generator,
+   constrTree,
+   constraintColumns,
+   newRecExprArray(),
+/* out */);
+
+  if ((isMerge()) && (mergeInsertRecExprArray().entries() > 0))
+{
+  // Generate the insert constraint expression, substituting 
Attributes for
--- End diff --

And this one


---


[GitHub] incubator-trafodion pull request #1253: [TRAFODION-1610][TRAFODION-2630] Gen...

2017-10-04 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1253#discussion_r142806660
  
--- Diff: core/sql/generator/GenRelUpdate.cpp ---
@@ -1718,19 +1806,56 @@ short HbaseUpdate::codeGen(Generator * generator)
 }
   else if (getIndexDesc()->isClusteringIndex() && 
getCheckConstraints().entries())
 {
-  GenAssert(FALSE, "Should not reach here. This update should have 
been transformed to delete/insert");
-  // To be uncommented when TRAFODION-1610 is implemented
-  // Need to generate insConstraintExpr also
-/*
+  // Generate the update and insert constraint check expressions
+
+  // The attributes for the columns referenced in the constraint 
expressions
+  // refer to the source values of the columns. We want to evaluate the
+  // constraints aganst the target values, though. So, there is some
+  // Attributes gymnastics that has to happen to generate them.
+
+  // Obtain the ValueIds of base table columns referenced in the
+  // constraints
+
+  ValueId constraintId;
+  ValueIdSet constraintColumns;
+  for (CollIndex ci = 0; ci < getCheckConstraints().entries(); ci++)
+{
+  constraintId = getCheckConstraints()[ci];
+  constraintId.getItemExpr()->findAll(ITM_INDEXCOLUMN,
+  constraintColumns, // out, 
has append semantics
+  TRUE, // visitVEGmembers
+  FALSE); // don't visit index 
descriptors
+}
+
+  // Prepare the constraint tree for generation
+
   ItemExpr *constrTree =
 getCheckConstraints().rebuildExprTree(ITM_AND, TRUE, TRUE);
 
   if (getTableDesc()->getNATable()->hasSerializedEncodedColumn())
-constrTree = generator->addCompDecodeForDerialization(constrTree);
+constrTree = generator->addCompDecodeForDerialization(constrTree, 
isAlignedFormat);
+
+  // Generate the update constraint expression, substituting 
Attributes for
--- End diff --

Should have edited this comment too


---


[GitHub] incubator-trafodion pull request #1253: [TRAFODION-1610][TRAFODION-2630] Gen...

2017-10-04 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1253#discussion_r142806590
  
--- Diff: core/sql/generator/GenRelUpdate.cpp ---
@@ -1718,19 +1806,56 @@ short HbaseUpdate::codeGen(Generator * generator)
 }
   else if (getIndexDesc()->isClusteringIndex() && 
getCheckConstraints().entries())
 {
-  GenAssert(FALSE, "Should not reach here. This update should have 
been transformed to delete/insert");
-  // To be uncommented when TRAFODION-1610 is implemented
-  // Need to generate insConstraintExpr also
-/*
+  // Generate the update and insert constraint check expressions
+
+  // The attributes for the columns referenced in the constraint 
expressions
+  // refer to the source values of the columns. We want to evaluate the
+  // constraints aganst the target values, though. So, there is some
+  // Attributes gymnastics that has to happen to generate them.
--- End diff --

Or at least edited them


---


[GitHub] incubator-trafodion pull request #1253: [TRAFODION-1610][TRAFODION-2630] Gen...

2017-10-04 Thread DaveBirdsall
Github user DaveBirdsall commented on a diff in the pull request:


https://github.com/apache/incubator-trafodion/pull/1253#discussion_r142806544
  
--- Diff: core/sql/generator/GenRelUpdate.cpp ---
@@ -1718,19 +1806,56 @@ short HbaseUpdate::codeGen(Generator * generator)
 }
   else if (getIndexDesc()->isClusteringIndex() && 
getCheckConstraints().entries())
 {
-  GenAssert(FALSE, "Should not reach here. This update should have 
been transformed to delete/insert");
-  // To be uncommented when TRAFODION-1610 is implemented
-  // Need to generate insConstraintExpr also
-/*
+  // Generate the update and insert constraint check expressions
+
+  // The attributes for the columns referenced in the constraint 
expressions
+  // refer to the source values of the columns. We want to evaluate the
+  // constraints aganst the target values, though. So, there is some
+  // Attributes gymnastics that has to happen to generate them.
--- End diff --

Oops... I should have deleted the comments from 1811-1814


---


  1   2   3   4   5   6   7   8   >