wuchong commented on a change in pull request #9511: [FLINK-13356][table][docs]
Add documentation for TopN and Deduplication in blink planner
URL: https://github.com/apache/flink/pull/9511#discussion_r316680304
##########
File path: docs/dev/table/sql.md
##########
@@ -813,6 +813,222 @@ LIMIT 3
{% top %}
+### Top-N
+
+TopN is used to calculate the maximum/minimum N records in a stream. It can be
flexibly completed based on OVER window aggregation. The grammar is shown as
below:
+
+Top-N queries ask for the N smallest or largest values ordered by columns.
Both smallest and largest values sets are considered Top-N queries. Top-N
queries are useful in cases where the need is to display only the N bottom-most
or the N top-
+most records from batch/stream table on a condition. This result set can be
used for further analysis.
+
+Flink uses the combination of a OVER window clause and a filter condition to
express a Top-N query. With the power of OVER window `PARTITION BY` clause,
Flink also supports per group Top-N. For example, the top five products per
category that have the maximum sales in realtime. Top-N queries are supported
for SQL on batch and streaming tables.
Review comment:
I think we also support this in batch?
The attention part and optimization part is only relative to streaming. I
can explain it more detailed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services