You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tw...@apache.org on 2018/08/14 09:42:08 UTC
[flink] 02/02: [hotfix] [table] [docs] Improvements for the
functions documentation
This is an automated email from the ASF dual-hosted git repository.
twalthr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 2f1689477a8b5de898e834deb5865ff68b3032a3
Author: Timo Walther <tw...@apache.org>
AuthorDate: Tue Aug 14 11:39:28 2018 +0200
[hotfix] [table] [docs] Improvements for the functions documentation
---
docs/dev/table/functions.md | 135 +++++++++++++++++++++++++++++++++++++++++---
docs/dev/table/sql.md | 119 ++------------------------------------
docs/dev/table/tableApi.md | 7 ++-
3 files changed, 139 insertions(+), 122 deletions(-)
diff --git a/docs/dev/table/functions.md b/docs/dev/table/functions.md
index f637b4d..cf42bfa 100644
--- a/docs/dev/table/functions.md
+++ b/docs/dev/table/functions.md
@@ -1,7 +1,7 @@
---
title: "Built-In Functions"
nav-parent_id: tableapi
-nav-pos: 45
+nav-pos: 31
---
<!--
Licensed to the Apache Software Foundation (ASF) under one
@@ -30,7 +30,8 @@ If you think that the function is general enough, please <a href="https://issues
{:toc}
Scalar Functions
------------------------------
+----------------
+
The scalar functions take zero, one or more values as the input and return a single value as the result.
### Comparison Functions
@@ -3127,7 +3128,7 @@ DATE_FORMAT(timestamp, string)
{% endhighlight %}
</td>
<td>
- <p>Returns a string that formats <i>timestamp</i> with a specified format <i>string</i>. The format specification is given in the <a href="sql.html#date-format-specifier">Date Format Specifier table</a>.</p>
+ <p>Returns a string that formats <i>timestamp</i> with a specified format <i>string</i>. The format specification is given in the <a href="#date-format-specifiers">Date Format Specifier table</a>.</p>
</td>
</tr>
@@ -3383,7 +3384,7 @@ dateFormat(TIMESTAMP, STRING)
{% endhighlight %}
</td>
<td>
- <p>Returns a string that formats <i>TIMESTAMP</i> with a specified format <i>STRING</i>. The format specification is given in the <a href="sql.html#date-format-specifier">Date Format Specifier table</a>.</p>
+ <p>Returns a string that formats <i>TIMESTAMP</i> with a specified format <i>STRING</i>. The format specification is given in the <a href="#date-format-specifiers">Date Format Specifier table</a>.</p>
<p>E.g., <code>dateFormat(ts, '%Y, %d %M')</code> results in strings formatted as "2017, 05 May".</p>
</td>
</tr>
@@ -3628,7 +3629,7 @@ dateFormat(TIMESTAMP, STRING)
{% endhighlight %}
</td>
<td>
- <p>Returns a string that formats <i>TIMESTAMP</i> with a specified format <i>STRING</i>. The format specification is given in the <a href="sql.html#date-format-specifier">Date Format Specifier table</a>.</p>
+ <p>Returns a string that formats <i>TIMESTAMP</i> with a specified format <i>STRING</i>. The format specification is given in the <a href="#date-format-specifiers">Date Format Specifier table</a>.</p>
<p>E.g., <code>dateFormat('ts, "%Y, %d %M")</code> results in strings formatted as "2017, 05 May".</p>
</td>
</tr>
@@ -3811,7 +3812,7 @@ ANY.cast(TYPE)
{% endhighlight %}
</td>
<td>
- <p>Returns a new <i>ANY</i> being cast to type <i>TYPE</i>. See the supported types <a href="sql.html#data-types">here</a>.</p>
+ <p>Returns a new <i>ANY</i> being cast to type <i>TYPE</i>. See the supported types <a href="tableApi.html#data-types">here</a>.</p>
<p>E.g., <code>'42'.cast(INT)</code> returns 42.</p>
</td>
</tr>
@@ -3836,7 +3837,7 @@ ANY.cast(TYPE)
{% endhighlight %}
</td>
<td>
- <p>Returns a new <i>ANY</i> being cast to type <i>TYPE</i>. See the supported types <a href="sql.html#data-types">here</a>.</p>
+ <p>Returns a new <i>ANY</i> being cast to type <i>TYPE</i>. See the supported types <a href="tableApi.html#data-types">here</a>.</p>
<p>E.g., <code>"42".cast(Types.INT)</code> returns 42.</p>
</td>
</tr>
@@ -4759,7 +4760,8 @@ ANY.as(NAME1, NAME2, ...)
</div>
Aggregate Functions
------------------------------
+-------------------
+
The aggregate functions take an expression across all the rows as the input and return a single aggregated value as the result.
<div class="codetabs" markdown="1">
@@ -5168,3 +5170,120 @@ FIELD.collect
</div>
{% top %}
+
+Date Format Specifiers
+----------------------
+
+The following table lists specifiers for date format functions.
+
+<table class="table table-bordered">
+ <thead>
+ <tr>
+ <th class="text-left" style="width: 40%">Specifier</th>
+ <th class="text-center">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr><td>{% highlight text %}%a{% endhighlight %}</td>
+ <td>Abbreviated weekday name (<code>Sun</code> .. <code>Sat</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%b{% endhighlight %}</td>
+ <td>Abbreviated month name (<code>Jan</code> .. <code>Dec</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%c{% endhighlight %}</td>
+ <td>Month, numeric (<code>1</code> .. <code>12</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%D{% endhighlight %}</td>
+ <td>Day of the month with English suffix (<code>0th</code>, <code>1st</code>, <code>2nd</code>, <code>3rd</code>, ...)</td>
+ </tr>
+ <tr><td>{% highlight text %}%d{% endhighlight %}</td>
+ <td>Day of the month, numeric (<code>01</code> .. <code>31</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%e{% endhighlight %}</td>
+ <td>Day of the month, numeric (<code>1</code> .. <code>31</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%f{% endhighlight %}</td>
+ <td>Fraction of second (6 digits for printing: <code>000000</code> .. <code>999000</code>; 1 - 9 digits for parsing: <code>0</code> .. <code>999999999</code>) (Timestamp is truncated to milliseconds.) </td>
+ </tr>
+ <tr><td>{% highlight text %}%H{% endhighlight %}</td>
+ <td>Hour (<code>00</code> .. <code>23</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%h{% endhighlight %}</td>
+ <td>Hour (<code>01</code> .. <code>12</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%I{% endhighlight %}</td>
+ <td>Hour (<code>01</code> .. <code>12</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%i{% endhighlight %}</td>
+ <td>Minutes, numeric (<code>00</code> .. <code>59</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%j{% endhighlight %}</td>
+ <td>Day of year (<code>001</code> .. <code>366</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%k{% endhighlight %}</td>
+ <td>Hour (<code>0</code> .. <code>23</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%l{% endhighlight %}</td>
+ <td>Hour (<code>1</code> .. <code>12</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%M{% endhighlight %}</td>
+ <td>Month name (<code>January</code> .. <code>December</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%m{% endhighlight %}</td>
+ <td>Month, numeric (<code>01</code> .. <code>12</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%p{% endhighlight %}</td>
+ <td><code>AM</code> or <code>PM</code></td>
+ </tr>
+ <tr><td>{% highlight text %}%r{% endhighlight %}</td>
+ <td>Time, 12-hour (<code>hh:mm:ss</code> followed by <code>AM</code> or <code>PM</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%S{% endhighlight %}</td>
+ <td>Seconds (<code>00</code> .. <code>59</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%s{% endhighlight %}</td>
+ <td>Seconds (<code>00</code> .. <code>59</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%T{% endhighlight %}</td>
+ <td>Time, 24-hour (<code>hh:mm:ss</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%U{% endhighlight %}</td>
+ <td>Week (<code>00</code> .. <code>53</code>), where Sunday is the first day of the week</td>
+ </tr>
+ <tr><td>{% highlight text %}%u{% endhighlight %}</td>
+ <td>Week (<code>00</code> .. <code>53</code>), where Monday is the first day of the week</td>
+ </tr>
+ <tr><td>{% highlight text %}%V{% endhighlight %}</td>
+ <td>Week (<code>01</code> .. <code>53</code>), where Sunday is the first day of the week; used with <code>%X</code></td>
+ </tr>
+ <tr><td>{% highlight text %}%v{% endhighlight %}</td>
+ <td>Week (<code>01</code> .. <code>53</code>), where Monday is the first day of the week; used with <code>%x</code></td>
+ </tr>
+ <tr><td>{% highlight text %}%W{% endhighlight %}</td>
+ <td>Weekday name (<code>Sunday</code> .. <code>Saturday</code>)</td>
+ </tr>
+ <tr><td>{% highlight text %}%w{% endhighlight %}</td>
+ <td>Day of the week (<code>0</code> .. <code>6</code>), where Sunday is the first day of the week</td>
+ </tr>
+ <tr><td>{% highlight text %}%X{% endhighlight %}</td>
+ <td>Year for the week where Sunday is the first day of the week, numeric, four digits; used with <code>%V</code></td>
+ </tr>
+ <tr><td>{% highlight text %}%x{% endhighlight %}</td>
+ <td>Year for the week, where Monday is the first day of the week, numeric, four digits; used with <code>%v</code></td>
+ </tr>
+ <tr><td>{% highlight text %}%Y{% endhighlight %}</td>
+ <td>Year, numeric, four digits</td>
+ </tr>
+ <tr><td>{% highlight text %}%y{% endhighlight %}</td>
+ <td>Year, numeric (two digits) </td>
+ </tr>
+ <tr><td>{% highlight text %}%%{% endhighlight %}</td>
+ <td>A literal <code>%</code> character</td>
+ </tr>
+ <tr><td>{% highlight text %}%x{% endhighlight %}</td>
+ <td><code>x</code>, for any <code>x</code> not listed above</td>
+ </tr>
+ </tbody>
+</table>
+
+{% top %}
diff --git a/docs/dev/table/sql.md b/docs/dev/table/sql.md
index 60f07ef..604e989 100644
--- a/docs/dev/table/sql.md
+++ b/docs/dev/table/sql.md
@@ -891,8 +891,13 @@ The SQL runtime is built on top of Flink's DataSet and DataStream APIs. Internal
| `Types.OBJECT_ARRAY` | `ARRAY` | e.g. `java.lang.Byte[]`|
| `Types.MAP` | `MAP` | `java.util.HashMap` |
| `Types.MULTISET` | `MULTISET` | e.g. `java.util.HashMap<String, Integer>` for a multiset of `String` |
+| `Types.ROW` | `ROW` | `org.apache.flink.types.Row` |
-Generic types and composite types (e.g., POJOs or Tuples) can be fields of a row as well. Generic types are treated as a black box and can be passed on or processed by [user-defined functions](udfs.html). Composite types can be accessed with [built-in functions](#built-in-functions) (see *Value access functions* section).
+Generic types and (nested) composite types (e.g., POJOs, tuples, rows, Scala case classes) can be fields of a row as well.
+
+Fields of composite types with arbitrary nesting can be accessed with [value access functions](functions.html#value-access-functions).
+
+Generic types are treated as a black box and can be passed on or processed by [user-defined functions](udfs.html).
{% top %}
@@ -907,117 +912,5 @@ A, ABS, ABSOLUTE, ACTION, ADA, ADD, ADMIN, AFTER, ALL, ALLOCATE, ALLOW, ALTER, A
{% endhighlight %}
-#### Date Format Specifier
-
-<table class="table table-bordered">
- <thead>
- <tr>
- <th class="text-left" style="width: 40%">Specifier</th>
- <th class="text-center">Description</th>
- </tr>
- </thead>
- <tbody>
- <tr><td>{% highlight text %}%a{% endhighlight %}</td>
- <td>Abbreviated weekday name (<code>Sun</code> .. <code>Sat</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%b{% endhighlight %}</td>
- <td>Abbreviated month name (<code>Jan</code> .. <code>Dec</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%c{% endhighlight %}</td>
- <td>Month, numeric (<code>1</code> .. <code>12</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%D{% endhighlight %}</td>
- <td>Day of the month with English suffix (<code>0th</code>, <code>1st</code>, <code>2nd</code>, <code>3rd</code>, ...)</td>
- </tr>
- <tr><td>{% highlight text %}%d{% endhighlight %}</td>
- <td>Day of the month, numeric (<code>01</code> .. <code>31</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%e{% endhighlight %}</td>
- <td>Day of the month, numeric (<code>1</code> .. <code>31</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%f{% endhighlight %}</td>
- <td>Fraction of second (6 digits for printing: <code>000000</code> .. <code>999000</code>; 1 - 9 digits for parsing: <code>0</code> .. <code>999999999</code>) (Timestamp is truncated to milliseconds.) </td>
- </tr>
- <tr><td>{% highlight text %}%H{% endhighlight %}</td>
- <td>Hour (<code>00</code> .. <code>23</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%h{% endhighlight %}</td>
- <td>Hour (<code>01</code> .. <code>12</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%I{% endhighlight %}</td>
- <td>Hour (<code>01</code> .. <code>12</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%i{% endhighlight %}</td>
- <td>Minutes, numeric (<code>00</code> .. <code>59</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%j{% endhighlight %}</td>
- <td>Day of year (<code>001</code> .. <code>366</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%k{% endhighlight %}</td>
- <td>Hour (<code>0</code> .. <code>23</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%l{% endhighlight %}</td>
- <td>Hour (<code>1</code> .. <code>12</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%M{% endhighlight %}</td>
- <td>Month name (<code>January</code> .. <code>December</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%m{% endhighlight %}</td>
- <td>Month, numeric (<code>01</code> .. <code>12</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%p{% endhighlight %}</td>
- <td><code>AM</code> or <code>PM</code></td>
- </tr>
- <tr><td>{% highlight text %}%r{% endhighlight %}</td>
- <td>Time, 12-hour (<code>hh:mm:ss</code> followed by <code>AM</code> or <code>PM</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%S{% endhighlight %}</td>
- <td>Seconds (<code>00</code> .. <code>59</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%s{% endhighlight %}</td>
- <td>Seconds (<code>00</code> .. <code>59</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%T{% endhighlight %}</td>
- <td>Time, 24-hour (<code>hh:mm:ss</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%U{% endhighlight %}</td>
- <td>Week (<code>00</code> .. <code>53</code>), where Sunday is the first day of the week</td>
- </tr>
- <tr><td>{% highlight text %}%u{% endhighlight %}</td>
- <td>Week (<code>00</code> .. <code>53</code>), where Monday is the first day of the week</td>
- </tr>
- <tr><td>{% highlight text %}%V{% endhighlight %}</td>
- <td>Week (<code>01</code> .. <code>53</code>), where Sunday is the first day of the week; used with <code>%X</code></td>
- </tr>
- <tr><td>{% highlight text %}%v{% endhighlight %}</td>
- <td>Week (<code>01</code> .. <code>53</code>), where Monday is the first day of the week; used with <code>%x</code></td>
- </tr>
- <tr><td>{% highlight text %}%W{% endhighlight %}</td>
- <td>Weekday name (<code>Sunday</code> .. <code>Saturday</code>)</td>
- </tr>
- <tr><td>{% highlight text %}%w{% endhighlight %}</td>
- <td>Day of the week (<code>0</code> .. <code>6</code>), where Sunday is the first day of the week</td>
- </tr>
- <tr><td>{% highlight text %}%X{% endhighlight %}</td>
- <td>Year for the week where Sunday is the first day of the week, numeric, four digits; used with <code>%V</code></td>
- </tr>
- <tr><td>{% highlight text %}%x{% endhighlight %}</td>
- <td>Year for the week, where Monday is the first day of the week, numeric, four digits; used with <code>%v</code></td>
- </tr>
- <tr><td>{% highlight text %}%Y{% endhighlight %}</td>
- <td>Year, numeric, four digits</td>
- </tr>
- <tr><td>{% highlight text %}%y{% endhighlight %}</td>
- <td>Year, numeric (two digits) </td>
- </tr>
- <tr><td>{% highlight text %}%%{% endhighlight %}</td>
- <td>A literal <code>%</code> character</td>
- </tr>
- <tr><td>{% highlight text %}%x{% endhighlight %}</td>
- <td><code>x</code>, for any <code>x</code> not listed above</td>
- </tr>
- </tbody>
-</table>
-
{% top %}
diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md
index 08ea36d..f8bcd3d 100644
--- a/docs/dev/table/tableApi.md
+++ b/docs/dev/table/tableApi.md
@@ -1577,8 +1577,13 @@ The Table API is built on top of Flink's DataSet and DataStream APIs. Internally
| `Types.OBJECT_ARRAY` | `ARRAY` | e.g. `java.lang.Byte[]`|
| `Types.MAP` | `MAP` | `java.util.HashMap` |
| `Types.MULTISET` | `MULTISET` | e.g. `java.util.HashMap<String, Integer>` for a multiset of `String` |
+| `Types.ROW` | `ROW` | `org.apache.flink.types.Row` |
-Generic types and composite types (e.g., POJOs or Tuples) can be fields of a row as well. Generic types are treated as a black box and can be passed on or processed by [user-defined functions](udfs.html). Composite types can be accessed with [built-in functions](#built-in-functions) (see *Value access functions* section).
+Generic types and (nested) composite types (e.g., POJOs, tuples, rows, Scala case classes) can be fields of a row as well.
+
+Fields of composite types with arbitrary nesting can be accessed with [value access functions](functions.html#value-access-functions).
+
+Generic types are treated as a black box and can be passed on or processed by [user-defined functions](udfs.html).
{% top %}