Hyunsik Choi created TAJO-757:
---------------------------------

             Summary: Add parser rule and algebraic expression for window 
function
                 Key: TAJO-757
                 URL: https://issues.apache.org/jira/browse/TAJO-757
             Project: Tajo
          Issue Type: Sub-task
            Reporter: Hyunsik Choi
            Assignee: Hyunsik Choi
             Fix For: 1.0-incubating


See the title. The object of this issue is to add ANTLR parser rule and 
algebraic expression for window function.

According to SQL 2003 standards, BNF for window function is as follows:

{noformat}
<window function>    ::=   <window function type> OVER <window name or 
specification>

<window function type>    ::= 
         <rank function type> <left paren> <right paren>
     |     ROW_NUMBER <left paren> <right paren>
     |     <aggregate function>

<rank function type>    ::=   RANK | DENSE_RANK | PERCENT_RANK | CUME_DIST

<window name or specification>    ::=   <window name> | <in-line window 
specification>

<in-line window specification>    ::=   <window specification>

<window specification>    ::=   <left paren> <window specification details> 
<right paren>

<window specification details>    ::= 
         [ <existing window name> ] [ <window partition clause> ] [ <window 
order clause> ] [ <window frame clause> ]

<existing window name>    ::=   <window name>

<window partition clause>    ::=   PARTITION BY <window partition column 
reference list>

<window partition column reference list>    ::=   <window partition column 
reference> [ { <comma> <window partition column reference> }... ]

<window partition column reference>    ::=   <column reference> [ <collate 
clause> ]

<window order clause>    ::=   ORDER BY <sort specification list>

<window frame clause>    ::=   <window frame units> <window frame extent> [ 
<window frame exclusion> ]

<window frame units>    ::=   ROWS | RANGE

<window frame extent>    ::=   <window frame start> | <window frame between>

<window frame start>    ::=   UNBOUNDED PRECEDING | <window frame preceding> | 
CURRENT ROW

<window frame preceding>    ::=   <unsigned value specification> PRECEDING

<window frame between>    ::=   BETWEEN <window frame bound 1> AND <window 
frame bound 2>

<window frame bound 1>    ::=   <window frame bound>

<window frame bound 2>    ::=   <window frame bound>

<window frame bound>    ::= 
         <window frame start>
     |     UNBOUNDED FOLLOWING 
     |     <window frame following>

<window frame following>    ::=   <unsigned value specification> FOLLOWING

<window frame exclusion>    ::= 
         EXCLUDE CURRENT ROW 
     |     EXCLUDE GROUP 
     |     EXCLUDE TIES 
     |     EXCLUDE NO OTHERS
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to