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 158DC200C78 for ; Thu, 18 May 2017 15:45:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1426F160BD0; Thu, 18 May 2017 13:45:09 +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 3AA37160BB0 for ; Thu, 18 May 2017 15:45:08 +0200 (CEST) Received: (qmail 96141 invoked by uid 500); 18 May 2017 13:45:07 -0000 Mailing-List: contact dev-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 dev@flink.apache.org Received: (qmail 96126 invoked by uid 99); 18 May 2017 13:45:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 May 2017 13:45:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 8DFF1C061B for ; Thu, 18 May 2017 13:45:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.897 X-Spam-Level: X-Spam-Status: No, score=-0.897 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id PYPymeMZUqFN for ; Thu, 18 May 2017 13:45:05 +0000 (UTC) Received: from mail-yb0-f176.google.com (mail-yb0-f176.google.com [209.85.213.176]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 7ADBE5FB96 for ; Thu, 18 May 2017 13:45:04 +0000 (UTC) Received: by mail-yb0-f176.google.com with SMTP id 187so4242484ybg.0 for ; Thu, 18 May 2017 06:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=PLDAGhX2jAZbibJkSXWi0M34IuqYHvKI1HHSf0mG+tY=; b=VVCliMXPpBdbv53Jjirxwdf7bmeceMfYDwaLSQm9YTo8vm99XA/K8IZSr1y60yUspi 1QJRmUgvrWVv73kkfreHGVKwdg89ETjQUijNW2op46Y7rqRZ08dPjeWWrwlJi5ZMk+el yaNcinqOmSQGCLAa2ejOPdEW9AkqCe6OMP7S6I7tkB9d4LyuGzqaVUHIgaPLeCEPzP5i vzwe3Pj1WaVBVy69gpgo7oMeLyH//pokgU9vs2Q4NfiyBxMpcbxUzhFeYbCizGB/bWXJ aE2raHSf7LC8H6sqlEDcG096QSg0UXwqmp0LolRa0M61EjP9RdKcQkx1MJ4XzA83JV2H HhFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=PLDAGhX2jAZbibJkSXWi0M34IuqYHvKI1HHSf0mG+tY=; b=psk1pQjZQ1hb42/7UgMujERYhAQ4wGH/icvcFd3x9VPtDIHG64ESebptZSuAqF6fXc jjguYgDd+1hBZY581iLpxu8OdVTEEyoNXHhR9v3rzTN0dbxHXx/4+XXprjTRn8jcgLFg XFUFo1WxR5fBdT5uXtq1lf9P8mJnBGMe4NFTDGd0OBQKldn6y+ypXTjgXtNyXJ0vlBsD by2bvn3T1iv9+bPSca54EdByLxWB49AEOK5bgdP0XOBXjLhV/0Gc9/Uy3WdYZTPSS6Vi MmyoERxLGJ34aZH2mrYJSzbxBW16ePEVev4XqfXXDt8ILZjQNdfTBY8m/+lFg+cm+nmO 2q5A== X-Gm-Message-State: AODbwcDJCv8KEzh9OzDK7c1ifqyzGj6gi7R6kbFRscgO9QXxlp5AeQUR UaAHeJJK+ws5XQwhsPz29VL9buAmKvVz X-Received: by 10.37.81.67 with SMTP id f64mr3488134ybb.22.1495115098491; Thu, 18 May 2017 06:44:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.83.41.4 with HTTP; Thu, 18 May 2017 06:44:28 -0700 (PDT) In-Reply-To: <8B754047F81D6B4290B9F4CE928333A517C6D12A@lhreml503-mbx> References: <8B754047F81D6B4290B9F4CE928333A517C6AFE6@lhreml503-mbx> <8B754047F81D6B4290B9F4CE928333A517C6CAC8@lhreml503-mbx> <6F8FD537-351D-47C6-9CCA-BE4B04D06AF5@data-artisans.com> <8B754047F81D6B4290B9F4CE928333A517C6D12A@lhreml503-mbx> From: Fabian Hueske Date: Thu, 18 May 2017 15:44:28 +0200 Message-ID: Subject: Re: ListState to List To: "dev@flink.apache.org" Content-Type: multipart/alternative; boundary="001a113dddd2584247054fcc9cc0" archived-at: Thu, 18 May 2017 13:45:09 -0000 --001a113dddd2584247054fcc9cc0 Content-Type: text/plain; charset="UTF-8" I think the ListState interface is pretty well suited for this job. It allows to add elements with low effort and can serve all elements of a list through an iterator. Depending on the implementation the elements could be deserialized as needed. If the user code needs a List with all elements, it won't make a big performance difference whether the state backend or the user code copies the elements into a List object. 2017-05-18 15:24 GMT+02:00 Radu Tudoran : > Actually that was one option that I was considering. I am still a bit > fuzzy about the advantages and disadvantages of using one type of state > over another. I know that using ValueState would mean that when getting the > object value (i.e. a List in this case) the whole would be deserialized at > once. This is ok if I need to go anyway through all elements. However, I > understand that when I need to update the state the same will hold - the > whole list would be serialized and re-write instead of a single element. > Therefore if we want to get always the best performances it seemed to me > that it would be worth considering have many specialized types of states - > hence my proposal. > > > > -----Original Message----- > From: Kostas Kloudas [mailto:k.kloudas@data-artisans.com] > Sent: Thursday, May 18, 2017 11:49 AM > To: dev@flink.apache.org > Subject: Re: ListState to List > > Hi Radu, > > Why not using a ValueState that inside stored the whole list. > Whenever you state#get() you get the whole list and you can sort it. > > Kostas > > > On May 18, 2017, at 3:31 AM, Radu Tudoran > wrote: > > > > Hi Aljoscha, > > > > Thanks for the clarification. I understand that there might be > advantages in some cases not to have the List-like interface, while in > other scenarios (like the one I described there aren't). Considering this, > why not having 2 type of states: ListState and StreamInListState - users > would use the one it is more appropriate. What do you think? > > > > -----Original Message----- > > From: Aljoscha Krettek [mailto:aljoscha@apache.org] > > Sent: Thursday, May 18, 2017 12:15 AM > > To: dev@flink.apache.org > > Subject: Re: ListState to List > > > > Hi, > > The interface is restrictive on purpose because depending on the state > backend it might not be possible to provide a List-like interface. There > might be state backends that stream in the list from somewhere else or > other restrictions. If we now allowed a more general interface here we > would possibly prevent optimisations in the future or make certain > implementations very hard to to efficiently. > > > > Best, > > Aljoscha > > > >> On 16. May 2017, at 21:56, Radu Tudoran > wrote: > >> > >> Hi, > >> > >> I would like to work with ListState, more specifically I would need to > access the contents and sort them. For this I would need a collection type > (e.g., the List, Array...). > >> However, I see that if I have a variable of type <> > the only interfaces I have are: > >> state.get -> which returns an Iterable Or state.get.getIterator which > >> returns an Iterator > >> > >> Basically if I use any of these I need now to copy the contents in an > actual List of Array. Is there any way to avoid this? ..perhaps there is > an implicit type that I can convert to... > >> > > > > --001a113dddd2584247054fcc9cc0--