Details

    • Sub-task
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 0.10.0, 0.11.0, 0.12.0, 0.13.0
    • None
    • None

    Description

      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, e.g.

      (select * from t1) union all (select * from t2) union (all select * from t3 order by 1);
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              shane.huang Shane Huang
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: