You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kylin.apache.org by "Yerui Sun (JIRA)" <ji...@apache.org> on 2016/07/26 11:28:20 UTC

[jira] [Updated] (KYLIN-1921) Support Grouping Funtions

     [ https://issues.apache.org/jira/browse/KYLIN-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yerui Sun updated KYLIN-1921:
-----------------------------
    Description: 
Usually we used 'group by dim1, dim2' to fetch the metrics with every value of dims, and we also want the summary metrics with the dim2 rolled up.
This case could be resolved by union two query, like:
{code}
select dim1, dim2 metric from table group by dim1, dim2
union all
select dim1, 'ALL', metric from table group by dim1
{code}

Now with the expression cube/rollup/grouping sets in calcite, we can make the query sql more simple and more clearly:
{code}
select dim1, case(grouping(dim2) when 1 then 'ALL' else dim2 end), metric
from table
group by grouping sets((dim1, dim2), (dim1))
{code}

  was:
Usually we used 'group by dim1, dim2' to fetch the metrics with every value of dims, and we also want the summary metrics with the dim2 rolled up.
This case could be resolved by union two query, like:
{code}
select dim1, dim2 metric from table group by dim1, dim2
union all
select dim1, 'ALL', metric from table group by dim1
{code}

Now with the expression cube/rollup/grouping sets in calcite, we can make the query sql more simple and more clearly:
{code}
select dim1, case(grouping(dim2) when 1 then 'ALL' else dim2 end) 
from table
group by grouping sets((dim1, dim2), (dim1))
{code}


> Support Grouping Funtions
> -------------------------
>
>                 Key: KYLIN-1921
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1921
>             Project: Kylin
>          Issue Type: New Feature
>          Components: Query Engine
>    Affects Versions: v1.5.4
>            Reporter: Yerui Sun
>            Assignee: Yerui Sun
>
> Usually we used 'group by dim1, dim2' to fetch the metrics with every value of dims, and we also want the summary metrics with the dim2 rolled up.
> This case could be resolved by union two query, like:
> {code}
> select dim1, dim2 metric from table group by dim1, dim2
> union all
> select dim1, 'ALL', metric from table group by dim1
> {code}
> Now with the expression cube/rollup/grouping sets in calcite, we can make the query sql more simple and more clearly:
> {code}
> select dim1, case(grouping(dim2) when 1 then 'ALL' else dim2 end), metric
> from table
> group by grouping sets((dim1, dim2), (dim1))
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)