[
https://issues.apache.org/jira/browse/TRAFODION-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15531490#comment-15531490
]
ASF GitHub Bot commented on TRAFODION-2246:
-------------------------------------------
GitHub user anoopsharma00 opened a pull request:
https://github.com/apache/incubator-trafodion/pull/733
[TRAFODION-2246] group by rollup feature
See comments listed below as part of commit.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anoopsharma00/incubator-trafodion
ansharma_rollup_br
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-trafodion/pull/733.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 #733
----
commit daeb4ae8bc084d72d2c99fb7b52c2a391234cc84
Author: Anoop Sharma <[email protected]>
Date: 2016-09-26T20:42:01Z
groupby rollup commit #1
commit 2a5b63252af09ea82b745ef581bd91ce4bad42c7
Author: Anoop Sharma <[email protected]>
Date: 2016-09-28T01:43:49Z
Merge remote branch 'origin/master' into ansharma_rollup_br
commit 95b4a123c2d32bbbcff681ab34da450d5c067a3b
Author: Anoop Sharma <[email protected]>
Date: 2016-09-29T01:29:15Z
jira TRAFODION-2246 Add support for GROUP BY ROLLUP feature
Syntax:
select item1, item2... from ... group by rollup (v1,...,vn)
Restrictions related to grouby rollup usage and query transformations
listed below. Some may be lifted in later checkins:
-- grouping column list must not have duplicate entries
-- aggrs must be min/max/sum/avg/count/count(*)
-- distinct aggregates are not supported
-- grouping columns/values must be nullable.
To group on a non-nullable item, use function
CAST(v as nullable).
This will convert v to nullable, if needed.
-- HAVING predicate will not be pushed down to scan predicate.
-- group by in a subquery will not be eliminated
-- grouping comparison predicate does not use pcode
-- group by rollup cannot be replaced by primary key
-- groupby will be done using sortgroupby since ordering is needed to
materialize rollup groups.
-- rollup groupby will be done at root (master root or esp root). This
is needed to detect rollup group changes across the whole result set.
-- since groupby can materialize new null rows for rollup groups,
a final sort operator is needed to be added after groupy even
if sortgroupby has already guaranteed that it gets rows in order.
Rollup computation logic is discussed in file executor/ex_sort_grby.cpp
prior to ex_sort_grby_rollup_tcb::work method.
See regress/seabase/TEST033 for tests of various 'group by rollup'
functionality.
----
> add support for GROUP BY ROLLUP feature
> ---------------------------------------
>
> Key: TRAFODION-2246
> URL: https://issues.apache.org/jira/browse/TRAFODION-2246
> Project: Apache Trafodion
> Issue Type: New Feature
> Reporter: Anoop Sharma
> Assignee: Anoop Sharma
> Priority: Minor
>
> group by rollup can accumulate rollup data and return it when a group
> or a member of a group changes.
> For ex:
> select a,b,sum(c) from t group by rollup (a,b)
> will return an extra row when group 'a' changes or when all groups
> are returned. Change is detected from left to right of the specified
> groups in the rollup clause. Grouping columns to the right of the
> changed group are returned as NULL values.
> Rollup grouping is equivalent to:
> select a,b,sum(c) from t group by (a,b) union all
> select, a, null, sum(c) from t group by (a) union all
> select null, null, sum(c) from t;
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)