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

Gopal V commented on HIVE-11424:
--------------------------------

Thanks [~jcamachorodriguez] for the patch. This patch allows us to fold 
transitive inferences and fix issues.

{code}
sold_date between '2014-01-01'  and '2014-02-01' and 
store_sk IN (1,2,3) and 
(sold_date >= '2014-01-01' and store_sk=1) or (sold_date >= '2014-01-01' and 
store_sk=2)
{code}

gets neatly folded by the partition condition remover to 

{code}
true and 
store_sk IN (1,2,3) and 
(true and store_sk=1) or (true and store_sk=2)
{code}

This is currently left in place as 

{code}
store_sk IN (1,2,3) and (store_sk=1 and store_sk=2)
{code}

We need to fold that into 

{code}
store_sk IN (1,2)
{code}

to get our stats right or map-join conversions can get turned on by artificial 
application of the filter twice on the statistics.

This can be done via the DNF expansion of IN & then refolding it back, but it 
is much slower to do that than a set intersection (or union for OR) for 
unordered IN() expressions.

> Rule to transform OR clauses into IN clauses in CBO
> ---------------------------------------------------
>
>                 Key: HIVE-11424
>                 URL: https://issues.apache.org/jira/browse/HIVE-11424
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>         Attachments: HIVE-11424.01.patch, HIVE-11424.01.patch, 
> HIVE-11424.03.patch, HIVE-11424.03.patch, HIVE-11424.04.patch, 
> HIVE-11424.2.patch, HIVE-11424.patch
>
>
> We create a rule that will transform OR clauses into IN clauses (when 
> possible).



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

Reply via email to