danny0405 opened a new pull request #13291:
URL: https://github.com/apache/flink/pull/13291
… wrong result
The batch mode rank only supports RANK function, so we only rewrite the
stream mode query.
## What is the purpose of the change
Fix the query of pattern:
```sql
SELECT state, name
FROM
(SELECT DISTINCT state FROM cities) states,
LATERAL (
SELECT name, pop
FROM cities
WHERE state = states.state
ORDER BY pop
DESC LIMIT 3
)
```
Before the patch, the query generates a wrong plan then wrong results.
## Brief change log
- Add a new rule `CorrelateSortToRankRule` for the rewrite
- Add plan test and IT test
## Verifying this change
Added tests.
## 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
- If yes, how is the feature documented? not documented
----------------------------------------------------------------
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]