Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 638DB200D24 for ; Tue, 24 Oct 2017 10:46:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 621C1160BF1; Tue, 24 Oct 2017 08:46:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A762D160BDB for ; Tue, 24 Oct 2017 10:46:07 +0200 (CEST) Received: (qmail 26776 invoked by uid 500); 24 Oct 2017 08:46:06 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 26767 invoked by uid 99); 24 Oct 2017 08:46:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Oct 2017 08:46:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id EB32C1A13AD for ; Tue, 24 Oct 2017 08:46:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.001 X-Spam-Level: X-Spam-Status: No, score=-100.001 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id OkLGrCni7WyN for ; Tue, 24 Oct 2017 08:46:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E5FDD5F3E1 for ; Tue, 24 Oct 2017 08:46:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6F794E0373 for ; Tue, 24 Oct 2017 08:46:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2E585212F5 for ; Tue, 24 Oct 2017 08:46:00 +0000 (UTC) Date: Tue, 24 Oct 2017 08:46:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-7821) Replace Table.limit() by Table.fetch() and Table.offset() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 24 Oct 2017 08:46:08 -0000 [ https://issues.apache.org/jira/browse/FLINK-7821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16216547#comment-16216547 ] ASF GitHub Bot commented on FLINK-7821: --------------------------------------- Github user twalthr commented on a diff in the pull request: https://github.com/apache/flink/pull/4813#discussion_r146490693 --- 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 -- Maybe you can add a notice about the SQL indices here, as it might confuses users. Or you add `skips 3 rows and begins with the 4th record`. > 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)