You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Rong Rong (JIRA)" <ji...@apache.org> on 2018/04/28 16:18:00 UTC

[jira] [Commented] (FLINK-7144) Optimize multiple LogicalAggregate into one

    [ https://issues.apache.org/jira/browse/FLINK-7144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16457685#comment-16457685 ] 

Rong Rong commented on FLINK-7144:
----------------------------------

FLINK-8689 has been merged and FLINK-8690 is on the way. Will fix this one as well :-)

> Optimize multiple LogicalAggregate into one
> -------------------------------------------
>
>                 Key: FLINK-7144
>                 URL: https://issues.apache.org/jira/browse/FLINK-7144
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API &amp; SQL
>            Reporter: Jark Wu
>            Assignee: Rong Rong
>            Priority: Major
>
> When applying multiple GROUP BY, and no aggregates or expression in the first GROUP BY,  and the second GROUP fields is a subset of first GROUP fields. Then the first GROUP BY can be removed. 
> Such as the following SQL , 
> {code}
> SELECT a FROM (SELECT a,b,c FROM MyTable GROUP BY a, b, c) GROUP BY a
> {code}
> should be optimized into 
> {code}
> DataStreamGroupAggregate(groupBy=[a], select=[a])
> DataStreamCalc(select=[a])
> DataStreamScan(table=[[_DataStreamTable_0]])
> {code}
> but get:
> {code}
> DataStreamGroupAggregate(groupBy=[a], select=[a])
> DataStreamCalc(select=[a])
> DataStreamGroupAggregate(groupBy=[a, b, c], select=[a, b, c])
> DataStreamScan(table=[[_DataStreamTable_0]])
> {code}
> I looked for the Calcite built-in rules, but can't find a match one. So maybe we should implement one , and maybe we should implement it in Calcite. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)