Shengsheng Huang created HIVE-3577:
--------------------------------------

             Summary: Subquery Unnesting
                 Key: HIVE-3577
                 URL: https://issues.apache.org/jira/browse/HIVE-3577
             Project: Hive
          Issue Type: Sub-task
    Affects Versions: 0.10.0
            Reporter: Shengsheng Huang


Hive requires subquery to be used only in the FROM clause. But real-world 
queries can be much more complex and subqueries could appear in WHERE, having 
and SELECT clauses. Many of such subqueries can be transformed/unnested to 
various join operations. This is an umbrella id to include all subquery 
unnesting work, specifically:

1. subquery in WHERE conditions, including subquery used as operand of IN, 
EXISTS, ISNULL ALL/ANY/SOME, and etc.

2. correlated subquery (a correlated subquery is a subquery that refers to a 
column of a table not in its FROM clause)
e.g. select * from t1 where exists ( select * from t2 where t1.b = t2.y );

3. scalar subquery (a subquery that returns exactly one column value from one 
row) 
e.g. select a,b,c,d,e,(select z from t2 where t2.y = t1.b and z != 99 ) from t1;

4. top-level subquery
(select * from t1) union all (select * from t2) union (all select * from t3 
order by 1);


  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to