[
https://issues.apache.org/jira/browse/FLINK-2955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14996656#comment-14996656
]
ASF GitHub Bot commented on FLINK-2955:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1318#discussion_r44282858
--- Diff: docs/libs/table.md ---
@@ -123,13 +123,205 @@ DataSet<WC> result = tableEnv.toDataSet(filtered,
WC.class);
When using Java, the embedded DSL for specifying expressions cannot be
used. Only String expressions
are supported. They support exactly the same feature set as the expression
DSL.
-## Expression Syntax
+## Table API Operators
+Table API provide a domain-spcific language to execute language-integrated
query on structured data in Scala and Java.
+This section gives a brief overview of all available operators. You can
find more details of operators in the
[Javadoc](http://flink.apache.org/docs/latest/api/java/org/apache/flink/api/table/Table.html).
+
+<div class="codetabs" markdown="1">
+<div data-lang="java" markdown="1">
+
+<br />
+
+<table class="table table-bordered">
+ <thead>
+ <tr>
+ <th class="text-left" style="width: 20%">Operators</th>
+ <th class="text-center">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td><strong>Select</strong></td>
+ <td>
+ <p>Similar to a SQL SELECT statement. Perform a select
operation.</p>
+{% highlight java %}
+Table in = tableEnv.fromDataSet(ds, "a, b, c");
+Table result = in.select("a, b, c as d");
+{% endhighlight %}
+ </td>
+ </tr>
+
+ <tr>
+ <td><strong>As</strong></td>
+ <td>
+ <p>Rename the fields name.</p>
+{% highlight java %}
+Table in = tableEnv.fromDataSet(ds, "a, b, c");
+Table result = in.as("d, e, f");
+{% endhighlight %}
+ </td>
+ </tr>
+
+ <tr>
+ <td><strong>Filter</strong></td>
+ <td>
+ <p>Similar to a SQL WHERE clause. Filter out elements that do not
pass the filter predicate.</p>
+{% highlight java %}
+Table in = tableEnv.fromDataSet(ds, "a, b, c");
+Table result = in.filter("a % 2 = 0");
+{% endhighlight %}
+ </td>
+ </tr>
+
+ <tr>
+ <td><strong>Where</strong></td>
+ <td>
+ <p>Similar to a SQL WHERE clause. Filter out elements that do not
pass the filter predicate.</p>
+{% highlight java %}
+Table in = tableEnv.fromDataSet(ds, "a, b, c");
+Table result = in.where("b = 'red'");
+{% endhighlight %}
+ </td>
+ </tr>
+
+ <tr>
+ <td><strong>GroupBy</strong></td>
+ <td>
+ <p>Similar to a SQL GROUPBY clause. Group the elements on the
grouping keys, with a following aggregation</p>
+ <p>operator to aggregate on per-group basis.</p>
+{% highlight java %}
+Table in = tableEnv.fromDataSet(ds, "a, b, c");
+Table result = in.groupby("a").select("a, b.sum");
+{% endhighlight %}
+ </td>
+ </tr>
-A `Table` supports to following operations: `select`, `where`, `groupBy`,
`join` (Plus `filter` as
-an alias for `where`.). These are also documented in the
[Javadoc](http://flink.apache.org/docs/latest/api/java/org/apache/flink/api/table/Table.html)
-of Table.
+ <tr>
+ <td><strong>Join</strong></td>
+ <td>
+ <p>Similar to a SQL JOIN clause. Join two tables, the fields of
two joined tables must not overlap.</p>
+{% highlight java %}
+Table left = tableEnv.fromDataSet(ds1, "a, b, c");
+Table right = tableEnv.fromDataSet(ds2, "d, e, f");
+Table result = left.join(right).where("a = d").select("a, b, e");
+{% endhighlight %}
+ </td>
+ </tr>
-Some of these expect an expression. These can either be specified using an
embedded Scala DSL or
+ <tr>
+ <td><strong>Union</strong></td>
+ <td>
+ <p>Similar to a SQL UNION ALL clause. Union two tables, the fields
of two unioned tables must overlap.</p>
--- End diff --
Rephrase "the fields of two unioned tables must overlap" to "Both tables
must have identical schema (field names and types)."
> Add operations introduction in Table API page.
> ----------------------------------------------
>
> Key: FLINK-2955
> URL: https://issues.apache.org/jira/browse/FLINK-2955
> Project: Flink
> Issue Type: New Feature
> Components: Documentation
> Reporter: Chengxiang Li
> Assignee: Chengxiang Li
> Priority: Minor
>
> On the Table API page, there is no formal introduction of current supported
> operations, it should be nice to have it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)