Krisztian Kasa created HIVE-24929:
-------------------------------------

             Summary: Allow correlated exists subqueries with windowing clause
                 Key: HIVE-24929
                 URL: https://issues.apache.org/jira/browse/HIVE-24929
             Project: Hive
          Issue Type: Improvement
          Components: Query Planning
            Reporter: Krisztian Kasa
            Assignee: Krisztian Kasa
             Fix For: 4.0.0


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.
{code}
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);
{code}
{code}
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);
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to