[ 
https://issues.apache.org/jira/browse/FLINK-7821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16201666#comment-16201666
 ] 

ASF GitHub Bot commented on FLINK-7821:
---------------------------------------

GitHub user fhueske opened a pull request:

    https://github.com/apache/flink/pull/4813

    [FLINK-7821] [table] Deprecate Table.limit() and replace it by 
Table.offset() and Table.fetch().

    ## What is the purpose of the change
    
    - `Table.limit(n)` has unexpected semantics of returning all but the first 
`n` rows.
    - Returning the first `n` rows from a sorted result requires to specify a 0 
offset (`table.orderBy(...).limit(0, n)`) which is more complicated than 
necessary.
    
    ## Brief change log
    
    - deprecate `Table.limit()` and replace it by `Table.offset()` and 
`Table.fetch()`
    
    ## Verifying this change
    
    - existing tests for `limit` were adapted for `offset` and `fetch`.
    
    ## Does this pull request potentially affect one of the following parts:
    
      - Dependencies (does it add or upgrade a dependency): **no**
      - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: **no**
      - The serializers: **no**
      - The runtime per-record code paths (performance sensitive): **no**
      - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Yarn/Mesos, ZooKeeper: **no**
    
    ## Documentation
    
    - Documentation was adapted.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/fhueske/flink tableOffsetFetch

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/4813.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4813
    
----
commit 7b1e3cb03a8e863699940b152f727551c2d43ea0
Author: Fabian Hueske <fhue...@apache.org>
Date:   2017-10-12T08:56:19Z

    [FLINK-7821] [table] Deprecate Table.limit() and replace it by 
Table.offset() and Table.fetch().

----


> 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)

Reply via email to