[
https://issues.apache.org/jira/browse/HIVE-6348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16047217#comment-16047217
]
Ashutosh Chauhan commented on HIVE-6348:
----------------------------------------
Turns out we already have such rules. They are HiveSortRemoveRule and
HiveSortMergeRule. First thing to verify is why they are not able to optimize
trees in these case.
[~lirui] CBO is now always enabled. It can only be turned off if user set
config to false explicitly, but that is true for any other config in system.
Even your patch adds a config, so if thats off, user won't get this
optimization either.
> Order by/Sort by in subquery
> ----------------------------
>
> Key: HIVE-6348
> URL: https://issues.apache.org/jira/browse/HIVE-6348
> Project: Hive
> Issue Type: Bug
> Reporter: Gunther Hagleitner
> Assignee: Rui Li
> Priority: Minor
> Labels: sub-query
> Attachments: HIVE-6348.1.patch, HIVE-6348.2.patch, HIVE-6348.3.patch
>
>
> select * from (select * from foo order by c asc) bar order by c desc;
> in hive sorts the data set twice. The optimizer should probably remove any
> order by/sort by in the sub query unless you use 'limit '. Could even go so
> far as barring it at the semantic level.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)