GitHub user hyunsik opened a pull request:
https://github.com/apache/tajo/pull/13
TAJO-774: Implement logical plan part and physical executor for window
function.
This patch adds the logical planning part, distributed planning part, and
sort-based window aggregation physical executors. They enables Tajo to use
existing aggregation functions in OVER clause and add row_number() and rank().
This implementation has some limits. First of all, this patch does not
support multiple different partition key groups in a query.
Example:
```
SELECT rank OVER(PARTITION BY P ORDER BY K), avg OVER( PARTITION BY P) ...
```
In above case, a query contains two OVER clauses which have the same
PARTITION KEY group. So, it becomes available in this patch. But, the following
case is not available.
```
SELECT rank OVER(PARTITION BY P ORDER BY K), avg OVER( PARTITION BY W) ...
```
In addition, there is one limit. This patch does not support the definition
clause for window specification. I'll add this feature later.
The followings are examples provided by this patch.
```
SELECT sum(l_quantity) OVER () FROM LINEITEM
SELECT l_orderkey, l_quantity, sum(l_quantity) OVER (PARTITION BY
l_orderkey) FROM LINEITEM
SELECT l_orderkey, l_discount, sum(l_discount) OVER (PARTITION BY
l_orderkey), sum(l_quantity) OVER (PARTITION BY l_orderkey) FROM
LINEITEM
SELECT l_orderkey, l_partkey, rank() OVER (ORDER BY l_orderkey) r1, rank()
OVER(ORDER BY l_partkey desc) r2 FROM LINEITEM
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hyunsik/tajo TAJO-774_2
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tajo/pull/13.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 #13
----
commit 95d1026043d711156e6d3ea62eacf8a9552fff7c
Author: Hyunsik Choi <[email protected]>
Date: 2014-05-20T18:34:18Z
TAJO-774: Implement logical plan part and physical executor for window
function.
----
---
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.
---