GitHub user shixuan-fan opened a pull request:
https://github.com/apache/incubator-quickstep/pull/39
QUICKSTEP-20: Resolver support for Window Aggregate Function
Now the resolver could form a logical plan for window aggregate function
based on the parsed result.
Suppose we have the following query:
SELECT attr0, avg(attr1) OVER
(PARTITION BY attr2
ORDER BY attr3
ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING)
FROM table1;
The logical plan will look like this:
input_table -> sort on (attr2, attr3) -> window aggregate -> project on
(attr0, avg(attr1)).
Two new classes are introduced:
quickstep::optimizer::expressions::WindowAggregateFunction and
quickstep::optimizer::logical::WindowAggregate:
-WindowAggregateFunction will keep the function information and window
information.
-WindowAggregate will store the input logical node and an alias wrapper
of WindowAggregateFunction.
In current version, we only support one window aggregate function. When the
PhysicalPlanGenerator sees a logical node with type kWindowAggregate, it will
throw an error saying that "window aggregate function is not supported".
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/apache/incubator-quickstep
SQL-window-aggregation
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-quickstep/pull/39.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 #39
----
commit ae66fbe467cfad0667efe87412f472e673c7cdc7
Author: shixuan <[email protected]>
Date: 2016-06-21T20:08:52Z
Window Aggregation Function in optimizer::expression added
The resolver could understand optional window clause.
The resolver could understand window aggregation functions.
Only one window aggregation function is allowed
commit a540e82ecf64a0c1dffaa6a338b6a69966724bb3
Author: Shixuan Fan <[email protected]>
Date: 2016-06-21T21:12:19Z
add has_window_aggregate_per_expression and update it while resolving
SELECT list
commit 9434e6c730023d66728e59482259ee8da7df514c
Author: shixuan-fan <[email protected]>
Date: 2016-06-22T14:49:24Z
Pass the reference of window_aggregation_expressions into
ExpressionResolutionInfo to keep it updated as resolving
commit 614d17deed54b26c250301fbb305cd2811c87909
Author: shixuan-fan <[email protected]>
Date: 2016-06-22T20:19:28Z
Added window aggregation class in logical
commit 9ac2fb0d7544475a3c76e81e28ba59db4378aef1
Author: shixuan-fan <[email protected]>
Date: 2016-06-23T14:40:44Z
added window name checking: duplicate definition and undefined
commit 160761c82407d6e6da2283fabdffae68607a7c08
Author: shixuan-fan <[email protected]>
Date: 2016-06-23T15:59:42Z
Formed logical plan.
A window aggregate function could form a logical plan now.
It will be intercepted by the stratagy in physical plan generator.
commit 5aa705835ced856dba35cbfd09d6fd95c1f99be2
Author: shixuan-fan <[email protected]>
Date: 2016-06-23T20:09:01Z
Added unittest for resolver and logical generator
commit 0210099e0655813311a973581f70cb69886320d9
Author: shixuan-fan <[email protected]>
Date: 2016-06-23T21:03:02Z
fixed cpplint issue
----
---
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.
---