flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twalthr <...@git.apache.org>
Subject [GitHub] flink pull request #4813: [FLINK-7821] [table] Deprecate Table.limit() and r...
Date Tue, 24 Oct 2017 08:45:02 GMT
Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4813#discussion_r146490303
  
    --- Diff: docs/dev/table/tableApi.md ---
    @@ -985,19 +985,22 @@ Table result = in.orderBy("a.asc");
     
         <tr>
           <td>
    -        <strong>Limit</strong><br>
    +        <strong>Offset &amp; 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 --
    
    No it must be 10th, because SQL indices start at 1.


---

Mime
View raw message