Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
When a Sort's input source max row numer is 1,then we could remove the redundant Sort,the Sort could be a sorted semantic Sort(offset and fetch is null).
For example,the sql:
select * from (select * from tableA limit 1) order by c ;
because the `(select * from tableA limit 1) ` max row number is 1, then we could remove order by c
select * from tableA limit 1;
The sql:
select max(totalprice) from orders order by 1
could converted to:
select max(totalprice) from orders
Above logic are same as Presto/Trino's RemoveRedundantSort rule:
Attachments
Issue Links
- relates to
-
CALCITE-6038 Remove 'ORDER BY ... LIMIT n' when input has at most one row, n >= 1, and there is no 'OFFSET' clause
- Closed
- links to