[ 
https://issues.apache.org/jira/browse/HIVE-14590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15431305#comment-15431305
 ] 

Ashutosh Chauhan commented on HIVE-14590:
-----------------------------------------

Problem is outerQueryLimit field is used to indicate limit on query. As a 
result fetch operator only fetches those many rows. Assume query is like (subq1 
limit 5) union (subq2 limit 5). Because of this bug limit in subquery becomes 
global limit of 5 and instead of 10 rows only 5 are fetched.
In the proposed fix, during Union operator conversion we check if there is any 
limit operator in subtree and clear out this outqueryLimit in such a case.

> CBO (Calcite Return Path) Incorrect result set when limit is present in one 
> of the union branches
> -------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-14590
>                 URL: https://issues.apache.org/jira/browse/HIVE-14590
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Logical Optimizer
>    Affects Versions: 2.0.0, 2.1.0
>            Reporter: Ashutosh Chauhan
>            Assignee: Ashutosh Chauhan
>         Attachments: HIVE-14590.patch
>
>
> Limit gets propagated outside union. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to