Hequn Cheng created FLINK-13392:
-----------------------------------
Summary: WindowAggregate inherited from Aggregate incorrectly
Key: FLINK-13392
URL: https://issues.apache.org/jira/browse/FLINK-13392
Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: Hequn Cheng
As discussed in FLINK-12249, the WindowAggregate inherited from Aggregate
incorrectly.
For WindowAggregate, the group keys are window group and normal fields (may be
empty), while Aggregate only has normal group keys part, and know nothing about
window group key. Currently, many planner rules match and apply transformations
on Aggregate, however some of them does not applicable to WindowAggregate, e.g.
AggregateJoinTransposeRule, AggregateProjectMergeRule, etc.
Although FLINK-12249 fixes the type equivalence check problem, we should do a
step further to correct the WindowAggregate behavior. There are three options
now:
# make Aggregate's group key supports expressions(such as RexCall), not field
reference only. and then the window group expression could be as a part of
Aggregate's group key. the disadvantage is we must update all existing
aggregate rules, metadata handlers, etc.
# make WindowAggregate extends from SingleRel, not from Aggregate. the
disadvantage is we must implement related planner rules about WindowAggregate.
# in logical phase, we does not merge Aggregate and Project (with window
group) into WindowAggregate, and convert the Project to a new kind of node
named WindowAssigner, which could prevent Project from being pushed
down/merged. and in physical phase, we merge them into WindowAggregate. the
advantage is we could reuse current aggregate rules, and the disadvantage is we
should add new rules about WindowAssigner.
We could have some further discussions in the jira ticket.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)