Github user xccui commented on a diff in the pull request: https://github.com/apache/flink/pull/4813#discussion_r146423039 --- Diff: docs/dev/table/tableApi.md --- @@ -985,19 +985,22 @@ Table result = in.orderBy("a.asc"); <tr> <td> - <strong>Limit</strong><br> + <strong>Offset & Fetch</strong><br> <span class="label label-primary">Batch</span> </td> <td> - <p>Similar to a SQL LIMIT clause. Limits a sorted result to a specified number of records from an offset position. Limit is technically part of the Order By operator and thus must be preceded by it.</p> + <p>Similar to the SQL OFFSET and FETCH clauses. Offset and Fetch limit the number of records returned from a sorted result. Offset and Fetch are technically part of the Order By operator and thus must be preceded by it.</p> {% highlight java %} Table in = tableEnv.fromDataSet(ds, "a, b, c"); -Table result = in.orderBy("a.asc").limit(3); // returns unlimited number of records beginning with the 4th record -{% endhighlight %} -or -{% highlight java %} -Table in = tableEnv.fromDataSet(ds, "a, b, c"); -Table result = in.orderBy("a.asc").limit(3, 5); // returns 5 records beginning with the 4th record + +// returns the first 5 records from the sorted result +Table result1 = in.orderBy("a.asc").fetch(5); + +// returns all records beginning with the 4th record from the sorted result +Table result2 = in.orderBy("a.asc").offset(3); + +// returns the first 5 records beginning with the 10th record from the sorted result --- End diff -- Should be 11th?
---