[
https://issues.apache.org/jira/browse/FLINK-7821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16216790#comment-16216790
]
ASF GitHub Bot commented on FLINK-7821:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/4813#discussion_r146540313
--- 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.
--- End diff --
will do
> 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)