suibianwanwank opened a new pull request, #4181:
URL: https://github.com/apache/calcite/pull/4181
This PR handles decorrelate since the query contains limit 1. There are two
main types of conversions:
1. If sorted with no OFFSET and FETCH = 1, and only one collation field,
rewrite the Sort as Aggregate using MIN/MAX function.
```
Example:
Sort(sort0=[$0], dir0=[ASC], fetch=[1])
input
Rewrite to:
Aggregate(group=(corVar), agg=[min($0))
```
2. For the more general case,rewrite the sort to be
```
Aggregate(group=(corVar.. , field..))
project(first_value(field) over (partition by corVar order by (sort
collation)))
input
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]