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 31F0C200C28 for ; Mon, 13 Mar 2017 18:29:22 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 308CF160B6C; Mon, 13 Mar 2017 17:29:22 +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 7B7E1160B5D for ; Mon, 13 Mar 2017 18:29:21 +0100 (CET) Received: (qmail 52565 invoked by uid 500); 13 Mar 2017 17:29:20 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@flink.apache.org Delivered-To: mailing list user@flink.apache.org Received: (qmail 50892 invoked by uid 99); 13 Mar 2017 17:29:19 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Mar 2017 17:29:19 +0000 Received: from mail-yw0-f170.google.com (mail-yw0-f170.google.com [209.85.161.170]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 0EC241A083C for ; Mon, 13 Mar 2017 17:29:19 +0000 (UTC) Received: by mail-yw0-f170.google.com with SMTP id p77so63565142ywg.1 for ; Mon, 13 Mar 2017 10:29:18 -0700 (PDT) X-Gm-Message-State: AMke39l89uidD5xzlb8W2XA0dheTPRWFaBZWd1VP6CSnjr0Wotoq3MjtHHSYBGhZVNTPWAEZF3/lkpu+uCGZgw== X-Received: by 10.37.229.73 with SMTP id c70mr17226450ybh.14.1489426158136; Mon, 13 Mar 2017 10:29:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.63.1 with HTTP; Mon, 13 Mar 2017 10:29:17 -0700 (PDT) In-Reply-To: References: From: Suneel Marthi Date: Mon, 13 Mar 2017 13:29:17 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Suggestion for top 'k' products To: user@flink.apache.org Content-Type: multipart/alternative; boundary=94eb2c0872a8133c0e054aa00df5 archived-at: Mon, 13 Mar 2017 17:29:22 -0000 --94eb2c0872a8133c0e054aa00df5 Content-Type: text/plain; charset=UTF-8 A simple way is to populate a Priority Queue of max size 'k' and implement a comparator on ur records. That would ensure that u always have Top k records at any instant in time. On Mon, Mar 13, 2017 at 1:25 PM, Meghashyam Sandeep V < vr1meghashyam@gmail.com> wrote: > Hi All, > > I'm trying to use Flink for a use case where I would want to see my top > selling products in time windows in near real time (windows of size 1-2 > mins if fine). I guess this is the most common use case to use streaming > apis in e-commerce. I see that I can iterate over records in a windowed > stream and do the sorting myself. I'm wondering if thats the best way. Is > there any in built sort functionality that I missed anywhere in Flink docs? > > Thanks, > Sandeep > --94eb2c0872a8133c0e054aa00df5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
A simple way is to populate a Priority Queue of =C2=A0max = size 'k' and implement a comparator on ur records.=C2=A0 That would= ensure that u always have Top k records at any instant in time.=C2=A0

On Mon, Mar 13, = 2017 at 1:25 PM, Meghashyam Sandeep V <vr1meghashyam@gmail.com&g= t; wrote:
Hi All,=

I'm trying to use Flink for a use case where I woul= d want to see my top selling products in time windows in near real time (wi= ndows of size 1-2 mins if fine). I guess this is the most common use case t= o use streaming apis in e-commerce. I see that I can iterate over records i= n a windowed stream and do the sorting myself. I'm wondering if thats t= he best way. Is there any in built sort functionality that I missed anywher= e in Flink docs?

Thanks,
Sandeep

--94eb2c0872a8133c0e054aa00df5--