You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/04/03 17:20:45 UTC
[5/5] impala git commit: IMPALA-6546: [DOCS] Add the new ODBC
functions to docs
IMPALA-6546: [DOCS] Add the new ODBC functions to docs
- Added the following new functions to the string functions doc:
left() and right()
- Added the following new functions to the date time functions doc:
monthname(), quarter(), week()
- Added quarter to extract() and date_part() as a unit
Change-Id: Icf31b50584628603c0c86ff0772a12ac6ac5c7b6
Reviewed-on: http://gerrit.cloudera.org:8080/9880
Reviewed-by: Alex Behm <al...@cloudera.com>
Tested-by: Impala Public Jenkins
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/6dacdcf1
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/6dacdcf1
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/6dacdcf1
Branch: refs/heads/2.x
Commit: 6dacdcf1c4f0468f2297437c37c9ad85017e8111
Parents: 1d0af16
Author: Alex Rodoni <ar...@cloudera.com>
Authored: Fri Mar 30 18:35:23 2018 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Tue Apr 3 00:55:30 2018 +0000
----------------------------------------------------------------------
docs/topics/impala_datetime_functions.xml | 91 +++++++++++++++++---------
docs/topics/impala_string_functions.xml | 16 +++++
2 files changed, 76 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/6dacdcf1/docs/topics/impala_datetime_functions.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_datetime_functions.xml b/docs/topics/impala_datetime_functions.xml
index d40e28b..cb2f03f 100644
--- a/docs/topics/impala_datetime_functions.xml
+++ b/docs/topics/impala_datetime_functions.xml
@@ -565,8 +565,8 @@ select now() as right_now, datediff(now(), now() - interval 18 hours) as 18_hour
<dlentry id="day">
<dt>
- <!-- <codeph>day(string date), <ph id="dayofmonth">dayofmonth(string date)</ph></codeph> -->
- <codeph>day(timestamp date), <ph id="dayofmonth">dayofmonth(timestamp date)</ph></codeph>
+ <codeph>day(timestamp date), <ph id="dayofmonth"
+ >dayofmonth(timestamp date)</ph></codeph>
</dt>
<dd>
@@ -684,7 +684,6 @@ select now() + interval 1 day as tomorrow,
<dlentry rev="1.1" id="dayofweek">
<dt>
- <!-- <codeph>dayofweek(string date)</codeph> -->
<codeph>dayofweek(timestamp date)</codeph>
</dt>
@@ -811,41 +810,47 @@ select now() as right_now, days_sub(now(), 31) as 31_days_ago;
<dlentry rev="1.4.0" id="extract">
<dt>
- <codeph>extract(timestamp, string unit)</codeph><codeph rev="2.0.0">extract(unit FROM timestamp)</codeph>
+ <codeph>extract(timestamp, string unit)</codeph>, <codeph rev="2.0.0">extract(unit FROM timestamp)</codeph>
</dt>
<dd>
<indexterm audience="hidden">extract() function</indexterm>
- <b>Purpose:</b> Returns one of the numeric date or time fields from a <codeph>TIMESTAMP</codeph> value.
- <p>
- <b>Unit argument:</b> The <codeph>unit</codeph> string can be one of <codeph>epoch</codeph>,
- <codeph>year</codeph>, <codeph>month</codeph>, <codeph>day</codeph>, <codeph>hour</codeph>,
- <codeph>minute</codeph>, <codeph>second</codeph>, or <codeph>millisecond</codeph>.
- This argument value is case-insensitive.
- </p>
- <p rev="2.0.0">
- In Impala 2.0 and higher, you can use special syntax rather than a regular function call, for
- compatibility with code that uses the SQL-99 format with the <codeph>FROM</codeph> keyword. With this
- style, the unit names are identifiers rather than <codeph>STRING</codeph> literals. For example, the
- following calls are both equivalent:
-<codeblock>extract(year from now());
+ <b>Purpose:</b> Returns one of the numeric date or time fields from a
+ <codeph>TIMESTAMP</codeph> value.
+ <p>
+ <b>Unit argument:</b> The <codeph>unit</codeph> string can be one of
+ <codeph>epoch</codeph>, <codeph>year</codeph>,
+ <codeph>quarter</codeph>, <codeph>month</codeph>,
+ <codeph>day</codeph>, <codeph>hour</codeph>,
+ <codeph>minute</codeph>, <codeph>second</codeph>, or
+ <codeph>millisecond</codeph>. This argument value is
+ case-insensitive.
+ </p>
+ <p rev="2.0.0"> In Impala 2.0 and higher, you can use special syntax
+ rather than a regular function call, for compatibility with code
+ that uses the SQL-99 format with the <codeph>FROM</codeph> keyword.
+ With this style, the unit names are identifiers rather than
+ <codeph>STRING</codeph> literals. For example, the following calls
+ are both equivalent:
+ <codeblock>extract(year from now());
extract(now(), "year");
</codeblock>
</p>
<p conref="../shared/impala_common.xml#common/usage_notes_blurb"/>
- <p>
- Typically used in <codeph>GROUP BY</codeph> queries to arrange results by hour,
- day, month, and so on. You can also use this function in an <codeph>INSERT ... SELECT</codeph> into a
- partitioned table to split up <codeph>TIMESTAMP</codeph> values into individual parts, if the
- partitioned table has separate partition key columns representing year, month, day, and so on. If you
- need to divide by more complex units of time, such as by week or by quarter, use the
- <codeph>TRUNC()</codeph> function instead.
- </p>
- <p>
- <b>Return type:</b> <codeph>int</codeph>
+ <p> Typically used in <codeph>GROUP BY</codeph> queries to arrange
+ results by hour, day, month, and so on. You can also use this
+ function in an <codeph>INSERT ... SELECT</codeph> into a partitioned
+ table to split up <codeph>TIMESTAMP</codeph> values into individual
+ parts, if the partitioned table has separate partition key columns
+ representing year, month, day, and so on. If you need to divide by
+ more complex units of time, such as by week or by quarter, use the
+ <codeph>TRUNC()</codeph> function instead. </p>
+ <p>
+ <b>Return type:</b>
+ <codeph>int</codeph>
</p>
<p conref="../shared/impala_common.xml#common/example_blurb"/>
-<codeblock>
+ <codeblock>
select now() as right_now,
extract(year from now()) as this_year,
extract(month from now()) as this_month;
@@ -1532,7 +1537,6 @@ select now() as right_now, minutes_sub(now(), 90) as 90_minutes_ago;
<dlentry id="month">
<dt>
- <!-- <codeph>month(string date)</codeph> -->
<codeph>month(timestamp date)</codeph>
</dt>
@@ -1554,6 +1558,19 @@ select now() as right_now, month(now()) as current_month;
</dd>
</dlentry>
+ <dlentry id="monthname">
+ <dt>
+ <codeph>monthname(timestamp date)</codeph>
+ </dt>
+ <dd>
+ <b>Purpose:</b> Returns the month field from a
+ <codeph>TIMESTAMP</codeph> value, converted to the string
+ corresponding to that month name.
+ <p>
+ <b>Return type:</b> <codeph>string</codeph>
+ </p>
+ </dd>
+ </dlentry>
<dlentry rev="1.3.0" id="months_add">
@@ -1953,6 +1970,19 @@ select now() as right_now,
</dd>
</dlentry>
+ <dlentry id="quarter">
+ <dt>
+ <codeph>quarter(timestamp date)</codeph>
+ </dt>
+ <dd>
+ <b>Purpose:</b> Returns the quarter in the input
+ <codeph>TIMESTAMP</codeph> expression as an integer value, 1, 2, 3, or
+ 4, where 1 represents January 1 through March 31.
+ <p>
+ <b>Return type:</b> <codeph>int</codeph>
+ </p>
+ </dd>
+ </dlentry>
<dlentry id="second">
@@ -2686,8 +2716,7 @@ select current_timestamp(), utc_timestamp();
<dlentry id="weekofyear">
<dt>
- <!-- <codeph>weekofyear(string date)</codeph> -->
- <codeph>weekofyear(timestamp date)</codeph>
+ <codeph>week(timestamp date)</codeph>, <codeph>weekofyear(timestamp date)</codeph>
</dt>
<dd>
http://git-wip-us.apache.org/repos/asf/impala/blob/6dacdcf1/docs/topics/impala_string_functions.xml
----------------------------------------------------------------------
diff --git a/docs/topics/impala_string_functions.xml b/docs/topics/impala_string_functions.xml
index a424683..fe08c8e 100644
--- a/docs/topics/impala_string_functions.xml
+++ b/docs/topics/impala_string_functions.xml
@@ -550,6 +550,14 @@ select instr('foo bar bletch', 'b', 1, null);
</dd>
</dlentry>
+ <dlentry id="left">
+ <dt>
+ <codeph>left(string a, int num_chars)</codeph>
+ </dt>
+ <dd>
+ See the <codeph>strleft</codeph> function.
+ </dd>
+ </dlentry>
<dlentry id="length">
@@ -1001,6 +1009,14 @@ select replace('hello world','xyz','abc');
</dd>
</dlentry>
+ <dlentry id="right">
+ <dt>
+ <codeph>right(string a, int num_chars)</codeph>
+ </dt>
+ <dd>
+ See the <codeph>strright</codeph> function.
+ </dd>
+ </dlentry>
<dlentry id="rpad">