[ 
https://issues.apache.org/jira/browse/FLINK-11454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16771715#comment-16771715
 ] 

Fabian Hueske commented on FLINK-11454:
---------------------------------------

[~walterddr] OVER implementation: If we want to reuse the {{AggregateFunction}} 
interface, we need to follow a different approach than in the SQL 
implementation because we do not have a retract method. Either we do the full 
list state approach of fully computing the result for every new record (as 
suggested by 2. if I understood you correctly.). Alternatively, we can also 
chunk the window into multiple partial windows. Most of the result will be 
compute by merging partials. The beginning and end of the window can be 
computed from the raw rows.

Flexibility: Did you think about just implementing Slice and Merge as two 
independent operators that are just chained (with interpret as keyed stream).

[~jark], OVER windows do not need retraction because they are ordered by time 
and result computation can be controlled with watermarks. 
Of course this increases the latency, but as long as the input does not have 
retractions (which would be the case in the DataStream API) can emit final 
results that do not need to be retracted.
The retract that Rong is referring to relates to the aggregation function which 
needs to remove move rows from a partial aggregate. An alternative can be to 
not keep partial aggregates and fully compute the result from all rows. There 
are also intermediate schemes possible like having multiple partial aggregates 
and fully computing only the beginning and the end "regions" of the window from 
the raw rows.


> Support MergedStream operation
> ------------------------------
>
>                 Key: FLINK-11454
>                 URL: https://issues.apache.org/jira/browse/FLINK-11454
>             Project: Flink
>          Issue Type: Sub-task
>          Components: DataStream API
>            Reporter: Rong Rong
>            Assignee: Rong Rong
>            Priority: Major
>
> {{Following SlicedStream, the mergedStream operator merges results from 
> sliced stream and produces windowing results.
> {code:java}
> val slicedStream: SlicedStream = inputStream
>   .keyBy("key")
>   .sliceWindow(Time.seconds(5L))       // new “slice window” concept: to 
> combine 
>                                        // tumble results based on discrete
>                                        // non-overlapping windows.
>   .aggregate(aggFunc)
> val mergedStream1: MergedStream = slicedStream
>   .slideOver(Time.second(10L))         // combine slice results with same     
>            
>                                        // windowing function, equivalent to 
>                                        // WindowOperator with an aggregate 
> state 
>                                        // and derived aggregate function.
> val mergedStream2: MergedStream = slicedStream
>   .slideOver(Count.of(5))
>   .apply(windowFunction)               // apply a different window function 
> over  
>                                        // the sliced results.{code}
> MergedStream are produced by MergeOperator:
> {{slideOver}} and {{apply}} can be combined into a {{OVER AGGREGATE}} 
> implementation similar to the one in TableAPI.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to