[
https://issues.apache.org/jira/browse/FLINK-7821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201795#comment-16201795
]
ASF GitHub Bot commented on FLINK-7821:
---------------------------------------
Github user hustfxj commented on a diff in the pull request:
https://github.com/apache/flink/pull/4813#discussion_r144257631
--- Diff:
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/api/batch/table/validation/SortValidationTest.scala
---
@@ -27,10 +27,26 @@ import org.junit._
class SortValidationTest extends TableTestBase {
--- End diff --
It had better add the following two validation tests:
```
ds.orderBy('a.asc).offset(10).offset(10)
ds.orderBy('a.asc).fetch(5)
```
Now` fetch` can only be used after `offset`, maybe the `fetch` be used
after `orderBy`. `ds.orderBy('a.asc).fetch(5)` is equivalent with
`ds.orderBy('a.asc).offset(0)fetch(5)`
> Replace Table.limit() by Table.fetch() and Table.offset()
> ---------------------------------------------------------
>
> Key: FLINK-7821
> URL: https://issues.apache.org/jira/browse/FLINK-7821
> Project: Flink
> Issue Type: Improvement
> Components: Table API & SQL
> Affects Versions: 1.4.0
> Reporter: Fabian Hueske
> Assignee: Fabian Hueske
> Priority: Minor
>
> The Table API method limit() exists in two variants:
> - {{limit(offset)}} returns all but the first {{offset}} records.
> - {{limit(offset, fetch)}} returns {{fetch}} records starting from the
> {{offset}}'s record.
> Especially, the behavior of {{limit(offset)}} is confusing because one would
> rather expect a behavior of returning the {{offset}} first records instead of
> all but the {{offset}} first records.
> Moreover, the only way to return the first {{x}} records is to specify a
> {{0}} offset as {{limit(0, x)}}.
> I propose to deprecate and replace both {{limit()}} variants by two new
> methods {{Table.offset(offset)}} and {{Table.fetch(fetch)}} that can be
> combined as follows:
> {code}
> table.orderBy(...).fetch(x)
> table.orderBy(...).offset(x)
> table.orderBy(...).offset(x).fetch(y)
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)