GitHub user sirpkt opened a pull request:

    https://github.com/apache/tajo/pull/351

    TAJO-919: Implement LAG and LEAD window functions

    This patch contains following changes
    - lead, lag are implemented. lag is implemented as window function as it 
only sees previous rows while lead is implemented as aggregation function since 
it should see next rows.
    - visitWindowFunction() in ExprAnnotator.java and TypeDeterminant.java is 
modified to support multiple arguments because current implementation only 
supports one argument for window function.
    
    There are some arguable points 
    - It assumes that offset value is non-negative.
    - Way to handle aggregation function in WindowAggExec.java is modified to 
call terminate for every Tuple, and it provides way to return different value 
for each terminate call, which is essential to implement lead function within 
current window supporting structure. However, it adds additional burden for 
other aggregation functions calculation because their terminate calls always 
induce the same calculation and return the same results.
    - lead implementation temporarily holds all the rows in the same partition 
in memory.
    
    Any idea about above points and about other parts of the patch, please. 

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sirpkt/tajo TAJO-919

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tajo/pull/351.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #351
    
----
commit 59baae3cdde8d7731bfb100f4589f46ff856faa7
Author: Keuntae Park <[email protected]>
Date:   2015-01-14T06:04:17Z

    Add window functions lag() and lead()

commit c382bed3e1273c54185cb1b4168291b7307099e6
Author: Keuntae Park <[email protected]>
Date:   2015-01-14T08:36:49Z

    add support for default value on lead, lag

commit 89b76319aa6d28abc1972e920407cb2cd1ed599b
Author: Keuntae Park <[email protected]>
Date:   2015-01-14T23:34:16Z

    lead, lag without argument and with default value

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to