hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashutosh Chauhan (JIRA)" <>
Subject [jira] [Commented] (HIVE-6348) Order by/Sort by in subquery
Date Wed, 07 Jun 2017 17:39:18 GMT


Ashutosh Chauhan commented on HIVE-6348:

I am not sure doing it on AST is better (or easier). AST is not amenable to traverse nor does
it contain semantic info. Easier (and correct) way IMO would be to write a rule on calcite
operator tree which matches on HiveSort followed by HiveSort check there is no limit in that
sort and than removes that HiveSort from tree. 
SubQueryRemove rule will remove subqueries from tree by than, but I dont think that will matter.
Essentially, on an operator tree you are looking for redundant Sort operators.

> Order by/Sort by in subquery
> ----------------------------
>                 Key: HIVE-6348
>                 URL:
>             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
> 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

This message was sent by Atlassian JIRA

View raw message