[
https://issues.apache.org/jira/browse/FLINK-6749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16041750#comment-16041750
]
ASF GitHub Bot commented on FLINK-6749:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/4046#discussion_r120754779
--- Diff: docs/dev/table/sql.md ---
@@ -163,31 +164,257 @@ For a better definition of SQL queries within a Java
String, Flink SQL uses a le
{% top %}
-Example Queries
----------------
+Operations
+--------------------
+
+### Scan, Projection, and Filter
-**TODO: Add a examples for different operations with similar structure as
for the Table API. Add highlighted tags if an operation is not supported by
stream / batch.**
-
-* Scan & Values
-* Selection & Projection
-* Aggregations (distinct only Batch)
- * GroupBy
- * GroupBy Windows (TUMBLE, HOP, SESSION)
- * OVER windows (Only Stream)
- * Grouping sets, rollup, cube (only batch)
- * Having (only batch?)
-* Joins
- * Inner equi joins (only batch)
- * Outer equi joins (only batch)
- * TableFunction
-* Set operations (only batch, except Union ALL)
-* OrderBy + Limit + Offset
+<div markdown="1">
+<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>Scan / Select / As</strong></td>
+ <td>
+{% highlight sql %}
+SELECT * FROM Orders
+SELECT a, c AS d FROM Orders
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Where / Filter</strong></td>
+ <td>
+{% highlight sql %}
+SELECT * FROM Orders WHERE b = 'red'
+SELECT * FROM Orders WHERE a % 2 = 0
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>User Defined Functions (UDF)</strong></td>
+ <td>
+ <p>SQL queries can refer to UDFs provided that they are registered
in the `TableEnvironment`.</p>
+{% highlight sql %}
+SELECT PRETTY_PRINT(user) FROM Orders
+{% endhighlight %}
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
{% top %}
-### GroupBy Windows
+### Aggregations
-**TODO: Integrate this with the examples**
+<div markdown="1">
+<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>GroupBy</strong></td>
+ <td>
+{% highlight sql %}
+SELECT a, SUM(b) as d FROM Orders GROUP BY a
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>GroupBy Window</strong></td>
+ <td>
+ <p>Use a group window to compute a single result row per group.
(See <a href="#group-windows">Group Windows</a> for more details.)</p>
+ {% highlight sql %}
+ SELECT user, SUM(amount) FROM Orders GROUP BY TUMBLE(rowtime,
INTERVAL '1' DAY), user
+ {% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Over Window</strong></td>
+ <td>
+{% highlight sql %}
+SELECT COUNT(amount) OVER (PARTITION BY user ORDER BY proctime ROWS
BETWEEN 2 PRECEDING AND CURRENT ROW) FROM Orders
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Distinct</strong>(Batch only)</td>
+ <td>
+{% highlight sql %}
+SELECT DISTINCT users FROM Orders
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Grouping sets, rollup, cube</strong>(Batch only)</td>
+ <td>
+{% highlight sql %}
+SELECT SUM(amount) FROM Orders GROUP BY GROUPING SETS ((user), (product))
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Having</strong>(Batch only)</td>
+ <td>
+{% highlight sql %}
+SELECT SUM(amount) FROM Orders GROUP BY users HAVING SUM(amount) > 50
+{% endhighlight %}
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+{% top %}
+
+### Joins
+
+<div markdown="1">
+<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>Inner Equi-join / Outer Equi-join</strong>(Batch
only)</td>
+ <td>
+{% highlight sql %}
+SELECT * FROM Orders INNER JOIN Product ON Orders.productId = Product.id
+SELECT * FROM Orders LEFT JOIN Product ON Orders.productId = Product.id
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Expanding arrays into a relation</strong></td>
+ <td>
+{% highlight sql %}
+SELECT users, tag FROM Orders CROSS JOIN UNNEST(tags) AS t (tag)
+{% endhighlight %}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>User Defined Table Function (UDTF)</strong></td>
+ <td>
+ <p>SQL queries can refer to UDTFs to expand a value into a relation
provided that they are registered in the <pre>TableEnvironment</pre>.</p>
--- End diff --
`<pre>TableFunction</pre>` is not nicely rendered in my setup. Can you
check on yours?
> Table API / SQL Docs: SQL Page
> ------------------------------
>
> Key: FLINK-6749
> URL: https://issues.apache.org/jira/browse/FLINK-6749
> Project: Flink
> Issue Type: Sub-task
> Components: Documentation, Table API & SQL
> Affects Versions: 1.3.0
> Reporter: Fabian Hueske
> Assignee: Haohui Mai
>
> Update and refine {{./docs/dev/table/sql.md}} in feature branch
> https://github.com/apache/flink/tree/tableDocs
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)