flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias J. Sax" <mj...@apache.org>
Subject Re: The way to itearte instances in AllWindowFunction in current Master branch
Date Thu, 25 Feb 2016 13:47:37 GMT
Just out of curiosity: Why was it changes like this. Specifying
"Iterable<...>" as type in AllWindowFunction seems rather unintuitive...

-Matthias

On 02/25/2016 01:58 PM, Aljoscha Krettek wrote:
> Hi,
> yes that is true. The way you would now write such a function is this:
> 
> private static class MyIterableFunction implements AllWindowFunction<Iterable<Tuple2<String,
Integer>>, Tuple2<String, Integer>, TimeWindow> {
>    private static final long serialVersionUID = 1L;
> 
>    @Override
>    public void apply(
>          TimeWindow window,
>          Iterable<Tuple2<String, Integer>> values,
>          Collector<Tuple2<String, Integer>> out) throws Exception {
> 
>    }
> }
> 
> (I used Tuple2<String, Integer> as an example input type here.)
> 
> and then you can use it with AllWindowedStream.apply(new MyIterableFunction());
> 
> 
>> On 25 Feb 2016, at 13:29, HungChang <unicorn.banachi@gmail.com> wrote:
>>
>> Thank you for your reply.
>>
>> The following in the current master looks like not iterable? because the
>> parameter is IN rather than Iterable<IN>
>> So I still have problem to iterate,,,
>>
>> @Public
>> public interface AllWindowFunction<IN, OUT,  W extends Window> extends
>> Function, Serializable {
>>
>> 	/**
>> 	 * Evaluates the window and outputs none or several elements.
>> 	 *
>> 	 * @param window The window that is being evaluated.
>> 	 * @param values The elements in the window being evaluated.
>> 	 * @param out A collector for emitting elements.
>> 	 *
>> 	 * @throws Exception The function may throw exceptions to fail the program
>> and trigger recovery.
>> 	 */
>> 	void apply(W window, IN values, Collector<OUT> out) throws Exception;
>> }
>>
>> https://github.com/apache/flink/blob/master/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/windowing/AllWindowFunction.java
>>
>> Best,
>>
>> Hung
>>
>>
>>
>> --
>> View this message in context: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/The-way-to-itearte-instances-in-AllWindowFunction-in-current-Master-branch-tp5137p5145.html
>> Sent from the Apache Flink User Mailing List archive. mailing list archive at Nabble.com.
> 


Mime
View raw message