You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by liuyu000 <gi...@git.apache.org> on 2018/07/19 12:48:27 UTC
[GitHub] trafodion pull request #1653: [TRAFODION-3156] Add *Syntax Descriptions and ...
GitHub user liuyu000 opened a pull request:
https://github.com/apache/trafodion/pull/1653
[TRAFODION-3156] Add *Syntax Descriptions and Examples* for *EXTRACT Function* in *Trafodion SQL Reference Manual*
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liuyu000/trafodion EXTRACTFunction
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafodion/pull/1653.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 #1653
----
commit c30816330060abb11b0b6b92ee63b1fba0d30fca
Author: liu.yu <qw...@...>
Date: 2018-07-19T12:46:11Z
[TRAFODION-3156] Add *Syntax Descriptions and Examples* for *EXTRACT Function* in *Trafodion SQL Reference Manual*
----
---
[GitHub] trafodion pull request #1653: [TRAFODION-3156] Add *Syntax Descriptions and ...
Posted by liuyu000 <gi...@git.apache.org>.
Github user liuyu000 commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1653#discussion_r204964420
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -4437,35 +4437,670 @@ interval value expression. It returns an exact numeric value.
EXTRACT (datetime-field FROM extract-source)
```
+[[extract_function_syntax]]
+=== Syntax Descriptions of EXTRACT Function
+
* `_datetime-field_` is:
+
-YEAR \| MONTH \| DAY \| HOUR \| MINUTE \| SECOND
+.Details of `_datetime-field_`
+[cols="20%,40%,40%"]
+|===
+^| `_datetime-filed_`
+^| *Description*
+^| *Supported* `_extract-source_`
+
+a| CENTURY
+| Century.
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+
+| DAY
+a| * `_datetime-expression_` +
+Day.
+* `_interval-expression_` +
+Number of day(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+
+| DECADE
+a| * `_datetime-expression_` +
+Year field divided by 10.
+* `_interval-expression_` +
+Number of decade(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| DOW
+| Day of week (1-7), where 1 is Sunday, 6 is Saturday. +
+This is not configurable.
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+| DOY
+| Day of year (1-366).
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+
+| EPOCH
+a| * `_datetime-expression_` +
+Second(s) since 1970-01-01 00:00:00. +
+The value is negative if `_datetime-expression_` precedes 1970-01-01 00:00:00.
+* `_interval-expression_` +
+Number of second(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| HOUR
+a| * `_datetime-expression_` +
+Hour (0-23).
+* `_interval-expression_` +
+Number of hour(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_` +
+** TIME
+** TIMESTAMP
+* `_interval-expression_`
+
+| MINUTE
+a| * `_datetime-expression_` +
+Minute (0-59).
+* `_interval-expression_` +
+Number of minute(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** TIME
+** TIMESTAMP
+* `_interval-expression_`
+
+| MONTH
+a| * `_datetime-expression_` +
+Month (1-12).
+* `_interval-expression_` +
+Number of month(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| QUARTER
+a| * `_datetime-expression_` +
+Quarter of year (1-4).
+* `_interval-expression_` +
+Number of quarter(s) in the `_interval-expression_`.
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| SECOND
+a| * `_datetime-expression_` +
+Second (0-59).
+* `_interval-expression_` +
+Number of second(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_` +
+** TIME
+** TIMESTAMP
+* `_interval-expression_` +
+
+| WEEK
+a| * `_datetime-expression_` +
+a| Week of year. +
+
+* The value 1 is returned for datetime that occurs in the first 7 days of the year if the year begins on Sunday. +
--- End diff --
Thanks Dave, I've corrected all 😁
---
[GitHub] trafodion pull request #1653: [TRAFODION-3156] Add *Syntax Descriptions and ...
Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1653#discussion_r204917685
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -4437,35 +4437,670 @@ interval value expression. It returns an exact numeric value.
EXTRACT (datetime-field FROM extract-source)
```
+[[extract_function_syntax]]
+=== Syntax Descriptions of EXTRACT Function
+
* `_datetime-field_` is:
+
-YEAR \| MONTH \| DAY \| HOUR \| MINUTE \| SECOND
+.Details of `_datetime-field_`
+[cols="20%,40%,40%"]
+|===
+^| `_datetime-filed_`
+^| *Description*
+^| *Supported* `_extract-source_`
+
+a| CENTURY
+| Century.
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+
+| DAY
+a| * `_datetime-expression_` +
+Day.
+* `_interval-expression_` +
+Number of day(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+
+| DECADE
+a| * `_datetime-expression_` +
+Year field divided by 10.
+* `_interval-expression_` +
+Number of decade(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| DOW
+| Day of week (1-7), where 1 is Sunday, 6 is Saturday. +
+This is not configurable.
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+| DOY
+| Day of year (1-366).
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+
+| EPOCH
+a| * `_datetime-expression_` +
+Second(s) since 1970-01-01 00:00:00. +
+The value is negative if `_datetime-expression_` precedes 1970-01-01 00:00:00.
+* `_interval-expression_` +
+Number of second(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| HOUR
+a| * `_datetime-expression_` +
+Hour (0-23).
+* `_interval-expression_` +
+Number of hour(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_` +
+** TIME
+** TIMESTAMP
+* `_interval-expression_`
+
+| MINUTE
+a| * `_datetime-expression_` +
+Minute (0-59).
+* `_interval-expression_` +
+Number of minute(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** TIME
+** TIMESTAMP
+* `_interval-expression_`
+
+| MONTH
+a| * `_datetime-expression_` +
+Month (1-12).
+* `_interval-expression_` +
+Number of month(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| QUARTER
+a| * `_datetime-expression_` +
+Quarter of year (1-4).
+* `_interval-expression_` +
+Number of quarter(s) in the `_interval-expression_`.
+a| * `_datetime-expression_`
+** DATE
+** TIMESTAMP
+* `_interval-expression_`
+
+| SECOND
+a| * `_datetime-expression_` +
+Second (0-59).
+* `_interval-expression_` +
+Number of second(s) in the `_interval-expression_`. +
+a| * `_datetime-expression_` +
+** TIME
+** TIMESTAMP
+* `_interval-expression_` +
+
+| WEEK
+a| * `_datetime-expression_` +
+a| Week of year. +
+
+* The value 1 is returned for datetime that occurs in the first 7 days of the year if the year begins on Sunday. +
--- End diff --
Minor wordsmith. Should say, "The value 1 is returned for a datetime ... " (add an indefinite article before "datetime"). The next few sentences need this too.
---
[GitHub] trafodion pull request #1653: [TRAFODION-3156] Add *Syntax Descriptions and ...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/trafodion/pull/1653
---