From user-return-25814-archive-asf-public=cust-asf.ponee.io@flink.apache.org Sun Feb 10 09:48:09 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 33A7018064C for ; Sun, 10 Feb 2019 10:48:09 +0100 (CET) Received: (qmail 6949 invoked by uid 500); 10 Feb 2019 09:48:07 -0000 Mailing-List: contact user-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list user@flink.apache.org Received: (qmail 6939 invoked by uid 99); 10 Feb 2019 09:48:07 -0000 Received: from mail-relay.apache.org (HELO mailrelay2-lw-us.apache.org) (207.244.88.137) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Feb 2019 09:48:07 +0000 Received: from [192.168.2.108] (p548F1871.dip0.t-ipconnect.de [84.143.24.113]) by mailrelay2-lw-us.apache.org (ASF Mail Server at mailrelay2-lw-us.apache.org) with ESMTPSA id BA8E12748; Sun, 10 Feb 2019 09:48:06 +0000 (UTC) Subject: Re: Can an Aggregate the key from a WindowedStream.aggregate() To: "stephen.alan.connolly@gmail.com" , user@flink.apache.org References: From: Chesnay Schepler Message-ID: Date: Sun, 10 Feb 2019 10:48:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US There are also versions of WindowedStream#aggregate that accept an additional WindowFunction/ProcessWindowFunction, which do have access to the key via apply()/process() respectively. These functions are called post aggregation. On 08.02.2019 18:24, stephen.alan.connolly@gmail.com wrote: > If I write my aggregation logic as a WindowFunction then I get access to the key as the first parameter in WindowFunction.apply(...) however the Javadocs for calling WindowedStream.apply(WindowFunction) state: > >> Note that this function requires that all data in the windows is buffered until the window >> is evaluated, as the function provides no means of incremental aggregation. > Which sounds bad. > > It seems the recommended alternative is to use one of the WindowFunction.aggregate(AggregateFunction) however I cannot see how to get access to the key... > > Is my only solution to transform my data into a Tuple if I need access to the key post aggregation? > > Thanks in advance > > -stephenc >