flink-issues mailing list archives

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

    https://github.com/apache/flink/pull/4813#discussion_r146424180
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/table.scala
---
    @@ -745,12 +748,65 @@ class Table(
         *
         * @param offset number of records to skip
         * @param fetch number of records to be returned
    +    *
    +    * @deprecated Please use [[Table.offset()]] and [[Table.fetch()]] instead.
         */
    +  @deprecated(message = "deprecated in favor of Table.offset() and Table.fetch()", since
= "1.4.0")
       def limit(offset: Int, fetch: Int): Table = {
         new Table(tableEnv, Limit(offset, fetch, logicalPlan).validate(tableEnv))
       }
     
       /**
    +    * Limits a sorted result from an offset position.
    +    * Similar to a SQL OFFSET clause. Offset is technically part of the Order By operator
and
    +    * thus must be preceded by it.
    +    *
    +    * [[Table.offset(o)]] can be combined with a subsequent [[Table.fetch(n)]] call to
return the
    +    * first n rows starting from the offset position o.
    +    *
    +    * {{{
    +    *   // returns unlimited number of records beginning with the 4th record
    +    *   tab.orderBy('name.desc).offset(3)
    +    *   // return the first 5 records starting from the 10th record
    +    *   tab.orderBy('name.desc).offset(10).fetch(5)
    +    * }}}
    +    *
    +    * @param offset number of records to skip
    +    */
    +  def offset(offset: Int): Table = {
    +    new Table(tableEnv, Limit(offset, -1, logicalPlan).validate(tableEnv))
    +  }
    +
    +  /**
    +    * Limits a sorted result to the first n rows.
    +    * Similar to a SQL FETCH clause. Fetch is technically part of the Order By operator
and
    +    * thus must be preceded by it.
    +    *
    +    * [[Table.fetch(n)]] can be combined with a preceding [[Table.offset(o)]] call to
return the
    +    * first n rows starting from the offset position o.
    +    *
    +    * {{{
    +    *   // returns the first 3 records.
    +    *   tab.orderBy('name.desc).fetch(3)
    +    *   // return the first 5 records starting from the 10th record
    --- End diff --
    
    11th?


---

Mime
View raw message