beyond1920 opened a new pull request #14602:
URL: https://github.com/apache/flink/pull/14602
## What is the purpose of the change
An `Expand` node is only necessary when multiple aggregate function with
different distinct keys appear in an Aggregate. However an unnecessary `Expand`
node will be generated under some special cases, like the following sql.
SELECT COUNT(c) AS pv, COUNT(DISTINCT c) AS uv FROM T GROUP BY a.
This pull request aims to avoid generate unnecessary `Expand` node.
## Brief change log
- `SplitAggregateRule` check only need expand if there are multiple
distinct aggregate functions in an Aggregate
## Verifying this change
This change is already covered by existing tests, such as
`SplitAggregateITCase`, `DistinctAggregateTest`, `SplitAggregateRuleTest` .
Besides, this change added IT and UT in `SplitAggregateITCase` and
`SplitAggregateRuleTest`
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (no)
- The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (no)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]