[jira] [Commented] (KYLIN-4011) Kyling grouping function
[ https://issues.apache.org/jira/browse/KYLIN-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17048540#comment-17048540 ] Roberto Tardío Olmos commented on KYLIN-4011: - Hi, In my case it does not work when I intorduce a join in order to use columns from dimensions tables and not from fact table. For example; The following query works well: SELECT part_dt, lstg_format_name, grouping(part_dt)+grouping(lstg_format_name) as lochierarchy, SUM(price), RANK() OVER( PARTITION BY grouping(part_dt)+grouping(lstg_format_name), case when grouping(lstg_format_name) = 0 then part_dt end ORDER BY SUM(price) asc) AS rank_within_parent FROM kylin_sales GROUP BY grouping sets((part_dt, lstg_format_name)) ORDER BY lochierarchy desc, case when lochierarchy = 0 then part_dt end, rank_within_parent ; However, if I introduce just a join with any dimension table, the query returns the following error: *RowType=19, ColumnRowType=17* while executing SQL: "SELECT part_dt, lstg_format_name, grouping(part_dt)+grouping(lstg_format_name) as lochierarchy, SUM(price), RANK() OVER( PARTITION BY grouping(part_dt)+grouping(lstg_format_name), case when grouping(lstg_format_name) = 0 then part_dt end ORDER BY SUM(price) asc) AS rank_within_parent FROM kylin_sales JOIN KYLIN_CAL_DT on part_dt = cal_dt GROUP BY grouping sets((part_dt, lstg_format_name)) ORDER BY lochierarchy desc, case when lochierarchy = 0 then part_dt end, rank_within_parent LIMIT 5" The query executed (in bold the join added) SELECT part_dt, lstg_format_name, grouping(part_dt)+grouping(lstg_format_name) as lochierarchy, SUM(price), RANK() OVER( PARTITION BY grouping(part_dt)+grouping(lstg_format_name), case when grouping(lstg_format_name) = 0 then part_dt end ORDER BY SUM(price) asc) AS rank_within_parent FROM kylin_sales *JOIN KYLIN_CAL_DT on part_dt = cal_dt* GROUP BY grouping sets((part_dt, lstg_format_name)) ORDER BY lochierarchy desc, case when lochierarchy = 0 then part_dt end, rank_within_parent ; Regards! Roberto > Kyling grouping function > > > Key: KYLIN-4011 > URL: https://issues.apache.org/jira/browse/KYLIN-4011 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v2.6.2 >Reporter: tag >Assignee: Yaqian Zhang >Priority: Major > Attachments: image-2019-11-05-18-04-46-639.png > > > {{```}} > {{select dim1, case grouping(dim2) when 1 then 'ALL' else dim2 end, sum(col) > as metric1 from table group by grouping sets((dim1, dim2), (dim1));}} > {{```}} > {{`case grouping(dim2) when 2 then 'All' else dim2 end` can work in version > v2.5.2, but invalid in version v2.6.2. }} > {{How to query aggregate by grouping sets?}} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4011) Kyling grouping function
[ https://issues.apache.org/jira/browse/KYLIN-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17047618#comment-17047618 ] Shao Feng Shi commented on KYLIN-4011: -- [~tagtang] could you provide more information? thx! > Kyling grouping function > > > Key: KYLIN-4011 > URL: https://issues.apache.org/jira/browse/KYLIN-4011 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v2.6.2 >Reporter: tag >Assignee: Yaqian Zhang >Priority: Major > Attachments: image-2019-11-05-18-04-46-639.png > > > {{```}} > {{select dim1, case grouping(dim2) when 1 then 'ALL' else dim2 end, sum(col) > as metric1 from table group by grouping sets((dim1, dim2), (dim1));}} > {{```}} > {{`case grouping(dim2) when 2 then 'All' else dim2 end` can work in version > v2.5.2, but invalid in version v2.6.2. }} > {{How to query aggregate by grouping sets?}} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4011) Kyling grouping function
[ https://issues.apache.org/jira/browse/KYLIN-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16967405#comment-16967405 ] Yaqian Zhang commented on KYLIN-4011: - Hi: I tested GROUPING function in kylin 2.6.3 and it works well. !image-2019-11-05-18-04-46-639.png|width=405,height=319! > Kyling grouping function > > > Key: KYLIN-4011 > URL: https://issues.apache.org/jira/browse/KYLIN-4011 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v2.6.2 >Reporter: tag >Assignee: Yaqian Zhang >Priority: Major > Attachments: image-2019-11-05-18-04-46-639.png > > > {{```}} > {{select dim1, case grouping(dim2) when 1 then 'ALL' else dim2 end, sum(col) > as metric1 from table group by grouping sets((dim1, dim2), (dim1));}} > {{```}} > {{`case grouping(dim2) when 2 then 'All' else dim2 end` can work in version > v2.5.2, but invalid in version v2.6.2. }} > {{How to query aggregate by grouping sets?}} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4011) Kyling grouping function
[ https://issues.apache.org/jira/browse/KYLIN-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16846492#comment-16846492 ] tag commented on KYLIN-4011: [~Shaofengshi] Thanks for you reply. `Grouping()` function works in v2.5.2 which blog you pose. But it invalid in v2.6.2. > Kyling grouping function > > > Key: KYLIN-4011 > URL: https://issues.apache.org/jira/browse/KYLIN-4011 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v2.6.2 >Reporter: tag >Priority: Major > > {{```}} > {{select dim1, case grouping(dim2) when 1 then 'ALL' else dim2 end, sum(col) > as metric1 from table group by grouping sets((dim1, dim2), (dim1));}} > {{```}} > {{`case grouping(dim2) when 2 then 'All' else dim2 end` can work in version > v2.5.2, but invalid in version v2.6.2. }} > {{How to query aggregate by grouping sets?}} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (KYLIN-4011) Kyling grouping function
[ https://issues.apache.org/jira/browse/KYLIN-4011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16845946#comment-16845946 ] Shaofeng SHI commented on KYLIN-4011: - Does this help? [https://kylin.apache.org/blog/2016/11/16/window-function/] > Kyling grouping function > > > Key: KYLIN-4011 > URL: https://issues.apache.org/jira/browse/KYLIN-4011 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v2.6.2 >Reporter: tag >Priority: Major > > {{```}} > {{select dim1, case grouping(dim2) when 1 then 'ALL' else dim2 end, sum(col) > as metric1 from table group by grouping sets((dim1, dim2), (dim1));}} > {{```}} > {{`case grouping(dim2) when 2 then 'All' else dim2 end` can work in version > v2.5.2, but invalid in version v2.6.2. }} > {{How to query aggregate by grouping sets?}} -- This message was sent by Atlassian JIRA (v7.6.3#76005)