Hequn Cheng created FLINK-12174:
-----------------------------------
Summary: Introduce FlinkAggregateExtractProjectRule and remove extractFieldReferences
Key: FLINK-12174
URL:
https://issues.apache.org/jira/browse/FLINK-12174 Project: Flink
Issue Type: Improvement
Components: Table SQL / API
Reporter: Hequn Cheng
Assignee: Hequn Cheng
Currently, when parsing Table API expression, an inner project will be added to projects fields for {{Aggregate}}s. As the code show below:
{code:java}
if (!extracted.getAggregations.isEmpty) {
val projectFields = extractFieldReferences(expressionsWithResolvedCalls)
wrap(
operationTreeBuilder.project(extracted.getProjections,
operationTreeBuilder.aggregate(emptyList[Expression], extracted.getAggregations,
operationTreeBuilder.project(projectFields, operationTree)
)
)
)
}
{code}
This optimization is not very suited to added here, instead, we can use a rule to achieve this. The `extractFieldReferences` method can also be removed if we use a rule which also makes the Expression parsing logic more clear.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)