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

sunjincheng commented on FLINK-6228:
------------------------------------

That's great [~fhueske]. :)

Here I have a question to ask for your opinion, the specific situation is this:
* Statistical requirements: The order amount rank per millisecond.
* OrderData:
{code}
(timestamp, orderId, amount)
(1L, order1, 2)
(1L, order2, 5)
(1L, order3, 3)
(1L, order4, 1)
(2L, order5, 20)
(2L, order6, 11)
(2L, order7, 9)
{code}

* The expected output is:
{code}
(timestamp, orderId, amount, rank)
(1L, order1, 2, 3)
(1L, order2, 5, 1)
(1L, order3, 3, 2)
(1L, order4, 1, 4)
(2L, order5, 20, 2)
(2L, order6, 11, 3)
(2L, order7, 30, 1)
{code}

Do you think we should support the following syntax?
{code}
 table
   .window(Tumble over 1.milli as 'w)
   .select('timestamp,'orderId, 'amount, order('amount) over 'w as 'rank)
{code}

Thanks, 
SunJincheng

> Integrating the OVER windows in the Table API
> ---------------------------------------------
>
>                 Key: FLINK-6228
>                 URL: https://issues.apache.org/jira/browse/FLINK-6228
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: sunjincheng
>            Assignee: sunjincheng
>
> Syntax:
> {code}
> table
>    .overWindows(
>     (Rows|Range [ partitionBy value_expression , ... [ n ]] [ orderBy 
> order_by_expression] 
>       (preceding  
> UNBOUNDED|value_specification.(rows|milli|second|minute|hour|day|month|year)|CURRENTROW)
>      [following 
> UNBOUNDED|value_specification.(rows|milli|second|minute|hour|day|month|year)|CURRENTROW]
>     as alias,...[n])
>    )
>   .select( [col1,...[n]], (agg(col1) OVER overWindowAlias, … [n])
> {code}
> Implement restrictions:
> * All OVER clauses in the same SELECT clause must be exactly the same.
> * The PARTITION BY clause is optional (no partitioning results in single 
> threaded execution).
> * The ORDER BY Before the 
> [FLINK-5884|https://issues.apache.org/jira/browse/FLINK-5884]  implementation 
> orderBy may only have ‘rowtime/’proctime(for stream)/‘specific-time-field(for 
> batch).
> * FOLLOWING is not supported.
> I will soon add a user interface design document.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to