[
https://issues.apache.org/jira/browse/TRAFODION-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15531669#comment-15531669
]
ASF GitHub Bot commented on TRAFODION-2246:
-------------------------------------------
Github user zellerh commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/733#discussion_r81059116
--- Diff: core/sql/optimizer/RelCache.cpp ---
@@ -418,6 +418,10 @@ void GroupByAgg::generateCacheKey(CacheWA &cwa) const
groupExpr_.rebuildExprTree(ITM_ITEM_LIST);
if (grpExpr) {
cwa += " gBy:";
+
+ if (isRollup())
+ cwa += " roll:";
+
--- End diff --
I think we also need to add the rollupGroupExprList() to the cache key. If
we rebuild the list above from a ValueIdSet on line 418 above, it is probably
going to be in the same order, regardless whether it was ROLLUP(a,b) or
ROLLUP(b,a).
> 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)