Hi John,

I agree that the Table.limit(offset) method is confusing and that the
semantics should rather be to specify the fetch parameter than the offset
parameter.
However, we can not easily change the behavior of an existing function. The
only way to evolve the functionality is to add new methods and deprecated
the old limit() method.

I also think that it would be better to have separate methods for offset()
and fetch().
We can even implement it in a way that all these combinations are valid:

table.orderBy().offset()
table.orderBy().fetch()
table.orderBy().offset().fetch()
table.orderBy().fetch().offset()

I have created FLINK-7821 to add offset() and fetch() and deprecate
limit(offset) and limit(offset, fetch).
I'll also create a PR for the issue very soon; PR reviews are welcome.

The requirement for orderBy() exists to ensure that queries are
deterministic.

Best, Fabian


2017-10-12 8:39 GMT+02:00 John Fang <hust...@gmail.com>:

> Now the Table don't support the limit operator without  orderBy operator.
>
> On Thu, Oct 12, 2017 at 2:30 PM, John Fang <hust...@gmail.com> wrote:
>
> > Hi,
> >
> >    In order to support  ORDER BY OFFSET FETCH, we add the Table API
> > `limit`. But the api is confused. For example: "table.limit(3)" means
> > unlimited number of records beginning with the 4th record. In fact I
> prefer
> > "table.limit(3)" means taking the first `3` rows.
> >   So I prefer to use the API "offset().fetch()" support ORDER BY OFFSET
> > FETCH. Of course, the "table.limit(n)" equivalent with the
> > "table.offset(0).fetch(n)",
> >
> > --
> >
> > Regards
> >
> > John Fang
> >
> >
> >
>
>
>
> --
>
> Regards
>
> John Fang
>

Reply via email to