Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-24929

Allow correlated exists subqueries with windowing clause

    XMLWordPrintableJSON

Details

    Description

      Currently queries which has windowing clause with subqueries are not supported by Hive: Hive rewrites subqueries to joins and the rewritten plan would lead to incorrect results such cases.
      However this restriction can be lifted in case of Exists/Not exists subqueries since those cases we don not interested in the result of the window function call but the existence of any record.

      select id, int_col
      from alltypesagg a
      where exists
        (select sum(int_col) over (partition by bool_col)
         from alltypestiny b
         where a.id = b.id);
      
      select id, int_col from alltypestiny t
      where not exists
        (select sum(int_col) over (partition by bool_col)
         from alltypesagg a where t.id = a.int_col);
      

      Attachments

        Issue Links

          Activity

            People

              kkasa Krisztian Kasa
              kkasa Krisztian Kasa
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h