[
https://issues.apache.org/jira/browse/CALCITE-3952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17090331#comment-17090331
]
Julian Hyde commented on CALCITE-3952:
--------------------------------------
When we generate the baseline xml file we insert tests in approximately
alphabetical order. Reduces merge conflicts. Better than editing manually.
LIMIT 0 should already be handled by PruneEmptyRules.
[~vgarg] be sure to check for OFFSET. If there is an offset you can’t safely
remove the Sort. (But maybe PruneEmptyRules could handle this case.)
> Improve SortRemoveRule to remove Sort based on rowcount
> -------------------------------------------------------
>
> Key: CALCITE-3952
> URL: https://issues.apache.org/jira/browse/CALCITE-3952
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Vineet Garg
> Assignee: Vineet Garg
> Priority: Major
>
> If a query is guaranteed to produce maximum one row it is safe to remove Sort
> (along with limit).
> Example:
> {code:sql}
> select count(*) cs from store_sales where ss_ext_sales_price > 100.00 order
> by cs limit 100
> {code}
> Although logically equivalent this can greatly benefit physical plans by
> removing extra operator and avoiding unnecessary data transfer.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)