You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fh...@apache.org on 2017/11/07 23:13:54 UTC

[2/2] flink git commit: [hotfix] [docs] Improve Supported Types section of Table API & SQL docs.

[hotfix] [docs] Improve Supported Types section of Table API & SQL docs.


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/f1ea6a69
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/f1ea6a69
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/f1ea6a69

Branch: refs/heads/master
Commit: f1ea6a6994f6a4f8d37c6d677b82c0bba06d205e
Parents: 9be150e
Author: Fabian Hueske <fh...@apache.org>
Authored: Tue Nov 7 23:43:45 2017 +0100
Committer: Fabian Hueske <fh...@apache.org>
Committed: Wed Nov 8 00:14:09 2017 +0100

----------------------------------------------------------------------
 docs/dev/table/sql.md      |  63 ++++++++++++-------------
 docs/dev/table/tableApi.md | 102 +++++++++++++++++++---------------------
 2 files changed, 77 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/f1ea6a69/docs/dev/table/sql.md
----------------------------------------------------------------------
diff --git a/docs/dev/table/sql.md b/docs/dev/table/sql.md
index 22eca0d..8525ecf 100644
--- a/docs/dev/table/sql.md
+++ b/docs/dev/table/sql.md
@@ -800,7 +800,7 @@ val result4 = tableEnv.sqlQuery(
 Data Types
 ----------
 
-The SQL runtime is built on top of Flink's DataSet and DataStream APIs. Internally, it also uses Flink's `TypeInformation` to distinguish between types. The SQL support does not include all Flink types so far. All supported simple types are listed in `org.apache.flink.table.api.Types`. The following table summarizes the relation between SQL Types, Table API types, and the resulting Java class.
+The SQL runtime is built on top of Flink's DataSet and DataStream APIs. Internally, it also uses Flink's `TypeInformation` to define data types. Fully supported types are listed in `org.apache.flink.table.api.Types`. The following table summarizes the relation between SQL Types, Table API types, and the resulting Java class.
 
 | Table API              | SQL                         | Java type              |
 | :--------------------- | :-------------------------- | :--------------------- |
@@ -823,21 +823,14 @@ The SQL runtime is built on top of Flink's DataSet and DataStream APIs. Internal
 | `Types.MAP`            | `MAP`                       | `java.util.HashMap`    |
 | `Types.MULTISET`       | `MULTISET`                  | e.g. `java.util.HashMap<String, Integer>` for a multiset of `String` |
 
-
-Advanced types such as generic types, composite types (e.g. POJOs or Tuples), and array types (object or primitive arrays) can be fields of a row.
-
-Generic types are treated as a black box within Table API and SQL yet.
-
-Composite types, however, are fully supported types where fields of a composite type can be accessed using the `.get()` operator in Table API and dot operator (e.g. `MyTable.pojoColumn.myField`) in SQL. Composite types can also be flattened using `.flatten()` in Table API or `MyTable.pojoColumn.*` in SQL.
-
-Array types can be accessed using the `myArray.at(1)` operator in Table API and `myArray[1]` operator in SQL. Array literals can be created using `array(1, 2, 3)` in Table API and `ARRAY[1, 2, 3]` in SQL.
+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).
 
 {% top %}
 
 Built-In Functions
 ------------------
 
-Both the Table API and SQL come with a set of built-in functions for data transformations. This section gives a brief overview of the available functions so far.
+Flink's SQL support comes with a set of built-in functions for data transformations. This section gives a brief overview of the available functions.
 
 <!--
 This list of SQL functions should be kept in sync with SqlExpressionTest to reduce confusion due to the large amount of SQL functions.
@@ -1819,6 +1812,7 @@ CAST(value AS type)
   </tbody>
 </table>
 
+<!-- Disabled temporarily in favor of composite type support
 <table class="table table-bordered">
   <thead>
     <tr>
@@ -1828,7 +1822,7 @@ CAST(value AS type)
   </thead>
 
   <tbody>
-  <!-- Disabled temporarily in favor of composite type support
+  
     <tr>
       <td>
         {% highlight text %}
@@ -1850,32 +1844,10 @@ ROW (value [, value]* )
         <p>Creates a row from a list of values.</p>
       </td>
     </tr>
--->
-
-    <tr>
-      <td>
-        {% highlight text %}
-array ‘[’ index ‘]’
-{% endhighlight %}
-      </td>
-      <td>
-        <p>Returns the element at a particular position in an array. The index starts at 1.</p>
-      </td>
-    </tr>
-
-    <tr>
-      <td>
-        {% highlight text %}
-ARRAY ‘[’ value [, value ]* ‘]’
-{% endhighlight %}
-      </td>
-      <td>
-        <p>Creates an array from a list of values.</p>
-      </td>
-    </tr>
 
   </tbody>
 </table>
+-->
 
 <table class="table table-bordered">
   <thead>
@@ -2283,6 +2255,18 @@ tableName.compositeType.*
   </thead>
 
   <tbody>
+
+    <tr>
+      <td>
+        {% highlight text %}
+ARRAY ‘[’ value [, value ]* ‘]’
+{% endhighlight %}
+      </td>
+      <td>
+        <p>Creates an array from a list of values.</p>
+      </td>
+    </tr>
+
     <tr>
       <td>
         {% highlight text %}
@@ -2297,6 +2281,17 @@ CARDINALITY(ARRAY)
     <tr>
       <td>
         {% highlight text %}
+array ‘[’ index ‘]’
+{% endhighlight %}
+      </td>
+      <td>
+        <p>Returns the element at a particular position in an array. The index starts at 1.</p>
+      </td>
+    </tr>
+
+    <tr>
+      <td>
+        {% highlight text %}
 ELEMENT(ARRAY)
 {% endhighlight %}
       </td>

http://git-wip-us.apache.org/repos/asf/flink/blob/f1ea6a69/docs/dev/table/tableApi.md
----------------------------------------------------------------------
diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md
index 2b45b5a..7cce042 100644
--- a/docs/dev/table/tableApi.md
+++ b/docs/dev/table/tableApi.md
@@ -1544,7 +1544,7 @@ The `OverWindow` defines a range of rows over which aggregates are computed. `Ov
 Data Types
 ----------
 
-The Table API is built on top of Flink's DataSet and DataStream API. Internally, it also uses Flink's `TypeInformation` to distinguish between types. The Table API does not support all Flink types so far. All supported simple types are listed in `org.apache.flink.table.api.Types`. The following table summarizes the relation between Table API types, SQL types, and the resulting Java class.
+The Table API is built on top of Flink's DataSet and DataStream APIs. Internally, it also uses Flink's `TypeInformation` to define data types. Fully supported types are listed in `org.apache.flink.table.api.Types`. The following table summarizes the relation between Table API types, SQL types, and the resulting Java class.
 
 | Table API              | SQL                         | Java type              |
 | :--------------------- | :-------------------------- | :--------------------- |
@@ -1565,15 +1565,9 @@ The Table API is built on top of Flink's DataSet and DataStream API. Internally,
 | `Types.PRIMITIVE_ARRAY`| `ARRAY`                     | e.g. `int[]`           |
 | `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` |
 
-
-Advanced types such as generic types, composite types (e.g. POJOs or Tuples), and array types (object or primitive arrays) can be fields of a row. 
-
-Generic types are treated as a black box within Table API and SQL yet.
-
-Composite types, however, are fully supported types where fields of a composite type can be accessed using the `.get()` operator in Table API and dot operator (e.g. `MyTable.pojoColumn.myField`) in SQL. Composite types can also be flattened using `.flatten()` in Table API or `MyTable.pojoColumn.*` in SQL.
-
-Array types can be accessed using the `myArray.at(1)` operator in Table API and `myArray[1]` operator in SQL. Array literals can be created using `array(1, 2, 3)` in Table API and `ARRAY[1, 2, 3]` in SQL.
+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).
 
 {% top %}
 
@@ -1654,7 +1648,7 @@ Temporal intervals can be represented as number of months (`Types.INTERVAL_MONTH
 Built-In Functions
 ------------------
 
-Both the Table API and SQL come with a set of built-in functions for data transformations. This section gives a brief overview of the available functions so far.
+The Table API comes with a set of built-in functions for data transformations. This section gives a brief overview of the available functions.
 
 <div class="codetabs" markdown="1">
 <div data-lang="java" markdown="1">
@@ -2471,28 +2465,6 @@ ANY.cast(TYPE)
     <tr>
       <td>
         {% highlight java %}
-ARRAY.at(INT)
-{% endhighlight %}
-      </td>
-      <td>
-        <p>Returns the element at a particular position in an array. The index starts at 1.</p>
-      </td>
-    </tr>
-
-    <tr>
-      <td>
-        {% highlight java %}
-array(ANY [, ANY ]*)
-{% endhighlight %}
-      </td>
-      <td>
-        <p>Creates an array from a list of values. The array will be an array of objects (not primitives).</p>
-      </td>
-    </tr>
-
-    <tr>
-      <td>
-        {% highlight java %}
 NUMERIC.rows
 {% endhighlight %}
       </td>
@@ -2929,6 +2901,17 @@ ANY.flatten()
     <tr>
       <td>
         {% highlight java %}
+array(ANY [, ANY ]*)
+{% endhighlight %}
+      </td>
+      <td>
+        <p>Creates an array from a list of values. The array will be an array of objects (not primitives).</p>
+      </td>
+    </tr>
+
+    <tr>
+      <td>
+        {% highlight java %}
 ARRAY.cardinality()
 {% endhighlight %}
       </td>
@@ -2940,6 +2923,17 @@ ARRAY.cardinality()
     <tr>
       <td>
         {% highlight java %}
+ARRAY.at(INT)
+{% endhighlight %}
+      </td>
+      <td>
+        <p>Returns the element at a particular position in an array. The index starts at 1.</p>
+      </td>
+    </tr>
+
+    <tr>
+      <td>
+        {% highlight java %}
 ARRAY.element()
 {% endhighlight %}
       </td>
@@ -3767,28 +3761,6 @@ ANY.cast(TYPE)
     <tr>
       <td>
         {% highlight scala %}
-ARRAY.at(INT)
-{% endhighlight %}
-      </td>
-      <td>
-        <p>Returns the element at a particular position in an array. The index starts at 1.</p>
-      </td>
-    </tr>
-
-    <tr>
-      <td>
-        {% highlight scala %}
-array(ANY [, ANY ]*)
-{% endhighlight %}
-      </td>
-      <td>
-        <p>Creates an array from a list of values. The array will be an array of objects (not primitives).</p>
-      </td>
-    </tr>
-
-    <tr>
-      <td>
-        {% highlight scala %}
 NUMERIC.rows
 {% endhighlight %}
       </td>
@@ -4223,6 +4195,17 @@ dateFormat(TIMESTAMP, STRING)
     <tr>
       <td>
         {% highlight scala %}
+array(ANY [, ANY ]*)
+{% endhighlight %}
+      </td>
+      <td>
+        <p>Creates an array from a list of values. The array will be an array of objects (not primitives).</p>
+      </td>
+    </tr>
+
+    <tr>
+      <td>
+        {% highlight scala %}
 ARRAY.cardinality()
 {% endhighlight %}
       </td>
@@ -4234,6 +4217,17 @@ ARRAY.cardinality()
     <tr>
       <td>
         {% highlight scala %}
+ARRAY.at(INT)
+{% endhighlight %}
+      </td>
+      <td>
+        <p>Returns the element at a particular position in an array. The index starts at 1.</p>
+      </td>
+    </tr>
+
+    <tr>
+      <td>
+        {% highlight scala %}
 ARRAY.element()
 {% endhighlight %}
       </td>