[ 
https://issues.apache.org/jira/browse/HIVE-24929?focusedWorklogId=571660&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-571660
 ]

ASF GitHub Bot logged work on HIVE-24929:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Mar/21 05:51
            Start Date: 25/Mar/21 05:51
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on a change in pull request #2112:
URL: https://github.com/apache/hive/pull/2112#discussion_r601070130



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/QBSubQuery.java
##########
@@ -606,7 +606,8 @@ void subqueryRestrictionsCheck(RowResolver parentQueryRR,
     /*
      * Restriction.14.h :: Correlated Sub Queries cannot contain Windowing 
clauses.
      */
-    if (  hasWindowing && hasCorrelation) {
+    if (operator.getType() != SubQueryType.EXISTS && operator.getType() != 
SubQueryType.NOT_EXISTS &&
+        hasWindowing && hasCorrelation) {
       throw new CalciteSubquerySemanticException(ASTErrorUtils.getMsg(
           ErrorMsg.UNSUPPORTED_SUBQUERY_EXPRESSION.getMsg(),
           subQueryAST, "Correlated Sub Queries cannot contain Windowing 
clauses."));

Review comment:
       Yes. Thanks for pointing out. Created follow-up patch of #2039: #2118




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 571660)
    Time Spent: 50m  (was: 40m)

> 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
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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