-
Notifications
You must be signed in to change notification settings - Fork 154
[TRAFODION-2734] Create *Trafodion SQL Large Objects Guide* 1 #1229
Conversation
Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2038/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2038/ |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2040/ |
Test Failed. https://jenkins.esgyn.com/job/Check-PR-master/2040/ |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2041/ |
Test Failed. https://jenkins.esgyn.com/job/Check-PR-master/2041/ |
jenkins, retest |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2042/ |
Test Failed. https://jenkins.esgyn.com/job/Check-PR-master/2042/ |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2043/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2043/ |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2044/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2044/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only got about half way through. I hope to have more time tomorrow to review the rest.
docs/lob_guide/pom.xml
Outdated
<artifactId>sql-reference-manual</artifactId> | ||
<version>${env.TRAFODION_VER}</version> | ||
<packaging>pom</packaging> | ||
<name>Trafodion SQL Reference Manual</name> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be different? Trafodion SQL Large Objects Guide perhaps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your reminding. :)
Yes I've changed it to Trafodion SQL Large Objects Guide.
docs/lob_guide/pom.xml
Outdated
<version>${env.TRAFODION_VER}</version> | ||
<packaging>pom</packaging> | ||
<name>Trafodion SQL Reference Manual</name> | ||
<description>This manual describes reference information about the syntax of SQL statements, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description probably should be changed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
Yes I've changed. :)
|
||
[[About_This_Document]] | ||
= About This Document | ||
This guide dwscribes how to use Large Object (LOB) datatypes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, "dwscribes". Also, might want to say "...how to use Large Object (LOB) datatypes in Trafodion SQL."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
[cols="30%,70%",options="header"] | ||
|=== | ||
|Chapter | Description | ||
| <<Introduction,Introduction>> | Introduces LOB and covers following topics: + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: "Introduces LOBs ..." is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
|=== | ||
|Chapter | Description | ||
| <<Introduction,Introduction>> | Introduces LOB and covers following topics: + | ||
• 1.1 <<what is lob,What is LOB>> + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: "what is a lob,What is a LOB" is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
|
||
LOB (Large Object), a set of large object data types used to store large volumes of data, provides random and piece-wise access to the data. | ||
|
||
Database support for LOB is not universal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this section, are you trying to define the concept of "LOB" in general (that is, for any database), or just for Trafodion? Are you trying to define the notion of a LOB data type? Or a value that might be stored there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Just for Trafodion.
- Both. Define the notion first, and then the value (1.4 LOB Handle).
|
||
Stores unusually large amounts of string data in character set format. + | ||
|
||
CLOB is ideal for storing and processing semi-structured data, such as large document or string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"... such as a large document or string" is better. Alternatively, "...such as large documents or strings"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
[#lob storage] | ||
== LOB Storage | ||
|
||
The basic design idea is to allow a database row to have multiple LOB columns and a table to have multiple such rows. The design takes a combination approach of rows store and column store. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"row store" is better ("row" is being used as an adjective)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
|
||
The basic design idea is to allow a database row to have multiple LOB columns and a table to have multiple such rows. The design takes a combination approach of rows store and column store. | ||
|
||
When a SQL table with LOB column is created, there are several dependent objects that are created to hold metadata information on the LOB as well as the data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"with a LOB column" is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
|
||
When a SQL table with LOB column is created, there are several dependent objects that are created to hold metadata information on the LOB as well as the data. | ||
|
||
The LOB data itself is stored in HDFS while the Trafodion table contains a unique LOB handle for each row/column. The LOB handle provides the identifier that is used to query the LOB metadata tables to find the location of the LOB data files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"an HDFS file" is better. A question: Is each LOB value stored in a separate HDFS file? Or are several LOB values stored in one HDFS file? Also, "...a unique LOB handle for each row/column" might be better stated, "...a unique LOB handle for each LOB value".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
I've corrected. :)
Answer from Sandhya:
Each lob column in any table will have it’s own unique lob data file. So any lob data belonging to that column will be stored in that HDFS file.
So if a table has 3 columns, you will see 3 lob data files with the first part of the name being the same and the column number will be appended to it.
For example, for a table with 2 lob columns:
Location: /user/trafodion/lobs
DataFile: LOBP_04474425229029907479_0001
Location: /user/trafodion/lobs
DataFile: LOBP_04474425229029907479_0002
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2045/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2045/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manual is looking very good. There is so much detail to be documented. I had some questions, and I've made a few suggestions.
[#external structure] | ||
=== External Structure | ||
|
||
The following is an external structure that is stored in the row of a SQL table: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean, "The following is an example of an external structure..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
Yes, I've corrected. :)
* LOB columns cannot be used as primary keys. | ||
* LOB columns cannot be used in CREATE INDEX statements. | ||
* LOB columns cannot be used in statistics update statements. | ||
* The file that contains data to insert from or to extract to need to be on platform linux or HDFS files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: "need to be" should be "needs to be" (because "needs" refers back to "The file" which is singular).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, "on platform linux or HDFS files." I think you mean, "on platform as a Linux or HDFS file."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
Yes, I've corrected. :)
//// | ||
|
||
[#work with lob] | ||
= Work with LOB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider "Working with LOBs"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave.
Using gerund or verb (base) in title/headline is a style issue that should be followed consistently.
Gerundive (continuous) form is common in title and verb form seems more imperative, but given that
- the topic title plays a huge role in the search results
- Trafodion has many users of non-native English speakers
I think the verb form might be better as it more likely to match what people will search for, and uses the more familiar form of the verb.
Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems ungrammatical to my ear. An imperative tense would clearly not be correct. We aren't telling the reader to "Work with LOBs!" (note the plural would be required, or alternatively the indefinite article, "Work with a LOB!"). Rather we are trying to describe how one works with LOBs. To me using the gerund seems most natural (in all cases, not just here); I would recommend changing the style to do that. Another possibility is to use the infinitive, e.g. "How to work with LOBs" (note again the plural). That might be more natural for English-as-a-second-language users whose native language lacks gerund-like inflections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed explanation! :)
I've changed to "Working with LOBs".
== Syntax | ||
|
||
``` | ||
CREATE TABLE table-name (lob-column-spec[, lob-column-spec]…) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax suggests that when you have lob columns in a table, you can't have other columns as well. Perhaps something like "CREATE TABLE table-name ( column_spec [, column_spec] ... [, primary_key_spec] )", then "column_spec is: lob-column-spec | other column spec"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave! :)
I'm planning to change it to:
CREATE TABLE table-name (column-spec[, column-spec]…)
column-spec is:
lob-column-spec |
other-column-spec
lob-column-spec is:
column-name {lob-data-type} [column-constraint]
other-column-spec is:
column-name {data-type} [column-constraint]
lob-data-type is:
BLOB | CLOB [({numeric literal} [unit])] [STORAGE 'storage literal']
...
Any comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave! :)
I've corrected.
* `_storage literal_` | ||
|
||
+ | ||
Currently Trafodion only support `'EXTERNAL'` here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar. Should be "... supports ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave, I've corrected. :)
+ | ||
Trafodion engine will retrieve exactly the amount of requested data. | ||
+ | ||
The user/application will be responsible for redriving the extract until EOD. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of "EOD", I'd suggest "end of data" (we haven't defined this acronym anywhere, and it's not clear that we need to).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave, I've corrected. :)
+ | ||
If the target file exists, Trafodion will truncate and write to it. | ||
+ | ||
If the target file does not exist, create a table, then write to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest "If the target file does not exist, Trafodion will create it and write to it." (I assume Trafodion is creating the file here and not creating a table somewhere.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave, I've corrected. :)
+ | ||
If the target file exists, Trafodion will append to it. | ||
+ | ||
If the target file does not exist, create a table, then write to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave, I've corrected. :)
[#extract lob data into a user specified buffer] | ||
=== Extract Lob Data into a User Specified Buffer | ||
|
||
Extract from a LOB column into a target user buffer of a specified size. Trafodion engine will retrieve exactly the amount of requested data. The user/application will be responsible for redriving the extract until EOD. Then the extracted buffer data can be written to files or another location as the application chooses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest "The Trafodion engine..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest also "end of data" instead of EOD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Dave, I've corrected. :)
|
||
Extract LOB data into a user specified buffer like a cursor until EOD is returned. For this method, the user specifies an input buffer and specifies the input length in an in/out variable. | ||
|
||
For each execution of the extract, Trafodion will return SUCCESS, ERROR or EOD. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are SUCCESS, ERROR and EOD literals in some programming language (such as Java or C++)? Or is it a string that is returned by the Trafodion engine? Or something else? (The sqlci examples below don't mention SUCCESS, ERROR or EOD.) Seems like some additional explanation or examples are needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion from Sandhya:
Change
"For each execution of the extract, Trafodion will return SUCCESS, ERROR or EOD.
For the cases of SUCCESS or EOD, a length will also be returned to the user, so the user knows exactly how much data was actually extracted and returned. "
to
"Each successful execution of the extract will also return the length in the parameter specified by the caller, so the user knows how much data was actually extracted and returned. "
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2058/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2058/ |
New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2076/ |
Test Passed. https://jenkins.esgyn.com/job/Check-PR-master/2076/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 This looks great! Thanks for making this contribution. I think it is ready to merge.
Changes proposed in this pull request: