flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sunjincheng (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-5386) Refactoring Window Clause
Date Tue, 17 Jan 2017 12:13:26 GMT

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

sunjincheng commented on FLINK-5386:

Hi [~fhueske] Thank you for the detailed explanation!!! 
If I understand you correctly, you mean that we should rely on the type of restrictions to
guide users to do the right thing, in this case:


tab //('a,'b,'c)
.window( ... on 'a as 'w1) //WindowedTable
.groupBy('w1,'a,'b) //GroupedTable
.select('a,'b,c.count as 'mycount) //Table
.window(...  on 'b as 'w2)


 is this correct? If not, please let me know ... thanks a lot.

> Refactoring Window Clause
> -------------------------
>                 Key: FLINK-5386
>                 URL: https://issues.apache.org/jira/browse/FLINK-5386
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: sunjincheng
>            Assignee: sunjincheng
> Similar to the SQL, window clause is defined "as" a symbol which is explicitly used in
groupby/over. We are proposing to refactor the way to write groupby+window tableAPI as follows:

> {code}
> val windowedTable = table
>  .window(Slide over 10.milli every 5.milli as 'w1)
>  .window(Tumble over 5.milli  as 'w2)
>  .groupBy('w1, 'key)
>  .select('string, 'int.count as 'count, 'w1.start)
>  .groupBy( 'w2, 'key)
>  .select('string, 'count.sum as sum2)
>  .window(Tumble over 5.milli  as 'w3)
>  .groupBy( 'w3) // windowAll
>  .select('sum2, 'w3.start, 'w3.end)
> {code}
> In this way, we can remove both GroupWindowedTable and the window() method in GroupedTable
which makes the API a bit clean. In addition, for row-window, we anyway need to define window
clause as a symbol. This change will make the API of window and row-window consistent, example
for row-window:
> {code}
>   .window(RowXXXWindow as ‘x, RowYYYWindow as ‘y)
>   .select(‘a, ‘b.count over ‘x as ‘xcnt, ‘c.count over ‘y as ‘ycnt, ‘x.start,
> {code}
> What do you think? [~fhueske] [~twalthr]

This message was sent by Atlassian JIRA

View raw message