You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sergey Nuyanzin (JIRA)" <ji...@apache.org> on 2018/05/25 08:15:00 UTC

[jira] [Comment Edited] (FLINK-8650) Add tests and documentation for WINDOW clause

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

Sergey Nuyanzin edited comment on FLINK-8650 at 5/25/18 8:14 AM:
-----------------------------------------------------------------

Hello [~twalthr] I would take this issue if you do not mind
a question for clarification: am I right that a good point to start is _org.apache.flink.table.runtime.stream.sql.OverWindowITCase_
and check the same queries with the same data but with window clause as you mentioned e.g.
now in _org.apache.flink.table.runtime.stream.sql.OverWindowITCase#testProcTimeBoundedPartitionedRowsOver_ there is 
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW), 
         MIN(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
   FROM MyTable
{code}
which could be checked against 
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW), 
         MIN(c) OVER w
   FROM MyTable WINDOW w AS (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
{code}
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER w,
         MIN(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW)
   FROM MyTable WINDOW w AS (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
{code}
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER w, 
         MIN(c) OVER w
   FROM MyTable WINDOW w AS (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
{code}

I guess one thing is it will be nice to do it not manually via copy paste but in a more intelligent approach


was (Author: sergey nuyanzin):
Hello [~twalthr] I would take this issue if you do not mind
a question for clarification: am I right that a good point to start is _org.apache.flink.table.runtime.stream.sql.OverWindowITCase_
and check the same queries with the same data but with window clause as you mentioned e.g.
now in _org.apache.flink.table.runtime.stream.sql.OverWindowITCase#testProcTimeBoundedPartitionedRowsOver_ there is 
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW), 
         MIN(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
   FROM MyTable
{code}
which could be checked against 
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW), 
         MIN(c) OVER w
   FROM MyTable WINDOW w AS  OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
{code}
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER w,
         MIN(c) OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW)
   FROM MyTable WINDOW w AS  OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
{code}
{code:sql}
   SELECT 
         a,  
         SUM(c) OVER w, 
         MIN(c) OVER w
   FROM MyTable WINDOW w AS  OVER (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW) 
{code}

I guess one thing is it will be nice to do it not manually via copy paste but in a more intelligent approach

> Add tests and documentation for WINDOW clause
> ---------------------------------------------
>
>                 Key: FLINK-8650
>                 URL: https://issues.apache.org/jira/browse/FLINK-8650
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API &amp; SQL
>            Reporter: Timo Walther
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>
> We support queries with a {{WINDOW}} clause like:
> {code}
> SELECT a, SUM(c) OVER w, MIN(c) OVER w FROM MyTable WINDOW w AS (PARTITION BY a ORDER BY proctime ROWS BETWEEN 4 PRECEDING AND CURRENT ROW)
> {code}
> But this is neither documented nor tested.



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