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

Hequn Cheng updated FLINK-12182:
--------------------------------
    Description: 
Currently, we add the AggregateProjectMergeRule.INSTANCE in logical rule sets 
and use it to remove project for aggregates. However, there are some bugs when 
this rule be applied for the LogicalWindowAggregate.

When the project was removed, the input field names are changed, so the rule 
has to update all fields in the Aggregate, while the field name in 
LogicalWindow in LogicalWindowAggregate has not taken into consideration in 
AggregateProjectMergeRule, as it is a rule in Calcite.

This problem also lies in other Aggregate rules such as 
FilterAggregateTransposeRule and AggregateProjectPullUpConstantsRule, etc.

As a quick fix, I think we can change
{code:java}
AggregateProjectMergeRule.INSTANCE,
{code}
to
{code:java}
    new AggregateProjectMergeRule(
      classOf[LogicalAggregate], classOf[Project], 
RelFactories.LOGICAL_BUILDER),
{code}

Of course, we need a complete solution for the LogicalWindowAggregate(use 
LogicalAggregate to express LogicalWindowAggregate), but not in this jira.

Any suggestions are welcomed!



  was:
Currently, we add the AggregateProjectMergeRule.INSTANCE in logical rule sets 
and use it to remove project for aggregates. However, there are some bugs when 
this rule be applied for the LogicalWindowAggregate.

When the project was removed, the input field names are changed, so the rule 
has to update all fields in the Aggregate, while the field name in 
LogicalWindow in LogicalWindowAggregate has not taken into consideration in 
AggregateProjectMergeRule, as it is a rule in Calcite.

As a quick fix, I think we can change
{code:java}
AggregateProjectMergeRule.INSTANCE,
{code}
to
{code:java}
    new AggregateProjectMergeRule(
      classOf[LogicalAggregate], classOf[Project], 
RelFactories.LOGICAL_BUILDER),
{code}

Of course, we need a complete solution for the LogicalWindowAggregate, but not 
in this jira.

Any suggestions are welcomed!




> AggregateProjectMergeRule can not handle LogicalWindowAggregate
> ---------------------------------------------------------------
>
>                 Key: FLINK-12182
>                 URL: https://issues.apache.org/jira/browse/FLINK-12182
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>            Reporter: Hequn Cheng
>            Assignee: Hequn Cheng
>            Priority: Major
>
> Currently, we add the AggregateProjectMergeRule.INSTANCE in logical rule sets 
> and use it to remove project for aggregates. However, there are some bugs 
> when this rule be applied for the LogicalWindowAggregate.
> When the project was removed, the input field names are changed, so the rule 
> has to update all fields in the Aggregate, while the field name in 
> LogicalWindow in LogicalWindowAggregate has not taken into consideration in 
> AggregateProjectMergeRule, as it is a rule in Calcite.
> This problem also lies in other Aggregate rules such as 
> FilterAggregateTransposeRule and AggregateProjectPullUpConstantsRule, etc.
> As a quick fix, I think we can change
> {code:java}
> AggregateProjectMergeRule.INSTANCE,
> {code}
> to
> {code:java}
>     new AggregateProjectMergeRule(
>       classOf[LogicalAggregate], classOf[Project], 
> RelFactories.LOGICAL_BUILDER),
> {code}
> Of course, we need a complete solution for the LogicalWindowAggregate(use 
> LogicalAggregate to express LogicalWindowAggregate), but not in this jira.
> Any suggestions are welcomed!



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

Reply via email to