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/03/20 06:36:42 UTC
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
GitHub user liuyu000 opened a pull request:
https://github.com/apache/trafodion/pull/1486
[TRAFODION-3001] Add an Overview of *Datetime Functions* in *Trafodion SQL Reference Manual*
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/liuyu000/trafodion DatetimeFunctions
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafodion/pull/1486.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 #1486
----
commit 3260a586edfdaaaea6f8c1c0710e8b2ec38bf569
Author: liu.yu <qw...@...>
Date: 2018-03-20T06:26:18Z
$ Add an Overview of *Datetime Functions* in *Trafodion SQL Reference
Manual
----
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/trafodion/pull/1486
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1486#discussion_r176223257
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -150,67 +150,109 @@ See the individual entry for the function.
== Datetime Functions
These functions use either a datetime value expression as an argument or
-return a result of datetime data type:
+return a result of DATETIME, VALUE or CHAR:
--- End diff --
The old text was correct. It categorized datetime functions as being those that either accept datetimes or produce them. The new change, though, would allow SUBSTRING as a Datetime function (since it produces a CHAR output).
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by liuyu000 <gi...@git.apache.org>.
Github user liuyu000 commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1486#discussion_r176313210
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -150,67 +150,109 @@ See the individual entry for the function.
== Datetime Functions
These functions use either a datetime value expression as an argument or
-return a result of datetime data type:
+return a result of DATETIME, VALUE or CHAR:
--- End diff --
@DaveBirdsall Thanks for your explanations, I've corrected. :)
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1486#discussion_r176224418
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -150,67 +150,109 @@ See the individual entry for the function.
== Datetime Functions
These functions use either a datetime value expression as an argument or
-return a result of datetime data type:
+return a result of DATETIME, VALUE or CHAR:
-[cols="25%,75%"]
+[caption="Table 7-3 "]
+.Overview of DATETIME Functions
+[cols="25%,50%,25%"]
|===
+| *Name* | *Description* | *Return Data Type*
| <<add_months_function,ADD_MONTHS Function>> | Adds the integer number of months specified by _intr_expr_
to _datetime_expr_ and normalizes the result.
+| DATE
| <<converttimestamp_function,CONVERTTIMESTAMP Function>> | Converts a Julian timestamp to a TIMESTAMP value.
+| TIMESTAMP
| <<current_function,CURRENT Function>> | Returns the current timestamp. You can also use the
<<current_timestamp_function,CURRENT_TIMESTAMP Function>>.
+| TIMESTAMP
| <<current_date_function,CURRENT_DATE Function>> | Returns the current date.
+| DATE
| <<current_time_function,CURRENT_TIME Function>> | Returns the current time.
+| TIME
| <<current_timestamp_function,CURRENT_TIMESTAMP Function>> | Returns the current timestamp. You can also use the <<current_function,CURRENT Function>>.
+| TIMESTAMP
| <<date_add_function,DATE_ADD Function>> | Adds the interval specified by _interval_expression_
to _datetime_expr_.
+| DATE
| <<date_part_function_of_an_interval,DATE_PART Function (of an Interval)>> | Extracts the datetime field specified by _text_ from the interval value
specified by interval and returns the result as an exact numeric value.
+| NUMERIC VALUE
--- End diff --
Not sure why we say "NUMERIC VALUE" instead of just "NUMERIC". A function that returns a DATE also returns a value; the value just happens to be a DATE. Though I suppose we could make a case for "NUMERIC VALUE" if we reason that "NUMERIC" is an adjective but not a noun. I would buy that.
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1486#discussion_r176224536
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -150,67 +150,109 @@ See the individual entry for the function.
== Datetime Functions
These functions use either a datetime value expression as an argument or
-return a result of datetime data type:
+return a result of DATETIME, VALUE or CHAR:
-[cols="25%,75%"]
+[caption="Table 7-3 "]
+.Overview of DATETIME Functions
+[cols="25%,50%,25%"]
|===
+| *Name* | *Description* | *Return Data Type*
| <<add_months_function,ADD_MONTHS Function>> | Adds the integer number of months specified by _intr_expr_
to _datetime_expr_ and normalizes the result.
+| DATE
| <<converttimestamp_function,CONVERTTIMESTAMP Function>> | Converts a Julian timestamp to a TIMESTAMP value.
+| TIMESTAMP
| <<current_function,CURRENT Function>> | Returns the current timestamp. You can also use the
<<current_timestamp_function,CURRENT_TIMESTAMP Function>>.
+| TIMESTAMP
| <<current_date_function,CURRENT_DATE Function>> | Returns the current date.
+| DATE
| <<current_time_function,CURRENT_TIME Function>> | Returns the current time.
+| TIME
| <<current_timestamp_function,CURRENT_TIMESTAMP Function>> | Returns the current timestamp. You can also use the <<current_function,CURRENT Function>>.
+| TIMESTAMP
| <<date_add_function,DATE_ADD Function>> | Adds the interval specified by _interval_expression_
to _datetime_expr_.
+| DATE
| <<date_part_function_of_an_interval,DATE_PART Function (of an Interval)>> | Extracts the datetime field specified by _text_ from the interval value
specified by interval and returns the result as an exact numeric value.
+| NUMERIC VALUE
| <<date_part_function_of_a_timestamp,DATE_PART Function (of a Timestamp)>> | Extracts the datetime field specified by _text_ from the datetime value
specified by timestamp and returns the result as an exact numeric value.
+| NUMERIC VALUE
| <<date_sub_function,DATE_SUB Function>> | Subtracts the specified _interval_expression_ from
_datetime_expr._
+| DATE or TIMESTAMP
| <<date_trunc_function,DATE_TRUNC Function>> | Returns the date with the time portion of the day truncated.
+| TIMESTAMP
| <<dateadd_function,DATEADD Function>> | Adds the interval specified by _datepart_ and _num_expr_
to _datetime_expr_.
+| DATE or TIMESTAMP
| <<datediff_function,DATEDIFF Function>> | Returns the integer value for the number of _datepart_ units of time
between _startdate_ and _enddate_.
+| INTEGER VALUE
--- End diff --
On the other hand, "INTEGER" is a noun as well as an adjective. So, "INTEGER" (without VALUE) seems better.
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by liuyu000 <gi...@git.apache.org>.
Github user liuyu000 commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1486#discussion_r176318566
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -150,67 +150,109 @@ See the individual entry for the function.
== Datetime Functions
These functions use either a datetime value expression as an argument or
-return a result of datetime data type:
+return a result of DATETIME, VALUE or CHAR:
-[cols="25%,75%"]
+[caption="Table 7-3 "]
+.Overview of DATETIME Functions
+[cols="25%,50%,25%"]
|===
+| *Name* | *Description* | *Return Data Type*
| <<add_months_function,ADD_MONTHS Function>> | Adds the integer number of months specified by _intr_expr_
to _datetime_expr_ and normalizes the result.
+| DATE
| <<converttimestamp_function,CONVERTTIMESTAMP Function>> | Converts a Julian timestamp to a TIMESTAMP value.
+| TIMESTAMP
| <<current_function,CURRENT Function>> | Returns the current timestamp. You can also use the
<<current_timestamp_function,CURRENT_TIMESTAMP Function>>.
+| TIMESTAMP
| <<current_date_function,CURRENT_DATE Function>> | Returns the current date.
+| DATE
| <<current_time_function,CURRENT_TIME Function>> | Returns the current time.
+| TIME
| <<current_timestamp_function,CURRENT_TIMESTAMP Function>> | Returns the current timestamp. You can also use the <<current_function,CURRENT Function>>.
+| TIMESTAMP
| <<date_add_function,DATE_ADD Function>> | Adds the interval specified by _interval_expression_
to _datetime_expr_.
+| DATE
| <<date_part_function_of_an_interval,DATE_PART Function (of an Interval)>> | Extracts the datetime field specified by _text_ from the interval value
specified by interval and returns the result as an exact numeric value.
+| NUMERIC VALUE
--- End diff --
@DaveBirdsall Thanks for your correction, I've changed "NUMERIC VALUE" to "NUMERIC".
---
[GitHub] trafodion pull request #1486: [TRAFODION-3001] Add an Overview of *Datetime ...
Posted by liuyu000 <gi...@git.apache.org>.
Github user liuyu000 commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1486#discussion_r176318854
--- Diff: docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -150,67 +150,109 @@ See the individual entry for the function.
== Datetime Functions
These functions use either a datetime value expression as an argument or
-return a result of datetime data type:
+return a result of DATETIME, VALUE or CHAR:
-[cols="25%,75%"]
+[caption="Table 7-3 "]
+.Overview of DATETIME Functions
+[cols="25%,50%,25%"]
|===
+| *Name* | *Description* | *Return Data Type*
| <<add_months_function,ADD_MONTHS Function>> | Adds the integer number of months specified by _intr_expr_
to _datetime_expr_ and normalizes the result.
+| DATE
| <<converttimestamp_function,CONVERTTIMESTAMP Function>> | Converts a Julian timestamp to a TIMESTAMP value.
+| TIMESTAMP
| <<current_function,CURRENT Function>> | Returns the current timestamp. You can also use the
<<current_timestamp_function,CURRENT_TIMESTAMP Function>>.
+| TIMESTAMP
| <<current_date_function,CURRENT_DATE Function>> | Returns the current date.
+| DATE
| <<current_time_function,CURRENT_TIME Function>> | Returns the current time.
+| TIME
| <<current_timestamp_function,CURRENT_TIMESTAMP Function>> | Returns the current timestamp. You can also use the <<current_function,CURRENT Function>>.
+| TIMESTAMP
| <<date_add_function,DATE_ADD Function>> | Adds the interval specified by _interval_expression_
to _datetime_expr_.
+| DATE
| <<date_part_function_of_an_interval,DATE_PART Function (of an Interval)>> | Extracts the datetime field specified by _text_ from the interval value
specified by interval and returns the result as an exact numeric value.
+| NUMERIC VALUE
| <<date_part_function_of_a_timestamp,DATE_PART Function (of a Timestamp)>> | Extracts the datetime field specified by _text_ from the datetime value
specified by timestamp and returns the result as an exact numeric value.
+| NUMERIC VALUE
| <<date_sub_function,DATE_SUB Function>> | Subtracts the specified _interval_expression_ from
_datetime_expr._
+| DATE or TIMESTAMP
| <<date_trunc_function,DATE_TRUNC Function>> | Returns the date with the time portion of the day truncated.
+| TIMESTAMP
| <<dateadd_function,DATEADD Function>> | Adds the interval specified by _datepart_ and _num_expr_
to _datetime_expr_.
+| DATE or TIMESTAMP
| <<datediff_function,DATEDIFF Function>> | Returns the integer value for the number of _datepart_ units of time
between _startdate_ and _enddate_.
+| INTEGER VALUE
--- End diff --
@DaveBirdsall Thanks for your correction, I've changed "INTEGER VALUE" to "INTERGER".
---