[
https://issues.apache.org/jira/browse/HIVE-6348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042415#comment-16042415
]
Rui Li commented on HIVE-6348:
------------------------------
Hi [~ashutoshc], I didn't put it in calcite because it won't work if CBO is
disabled.
My plan is to do it after we've done {{genResolvedParseTree}} on the AST, at
which point parse info of each QB is generated. To remove the order by, we can
simply remove the corresponding AST node. I feel it more complicated to do it
in operator tree, e.g. we have to detect sorting RS in sub queries, and after
the RS is removed (actually that's probably not the only OP that needs be
removed), we may also have to do some modifications to upstream/downstream
operators.
Upload patch v3 for test and demonstrate my idea.
> 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.3.15#6346)