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

Zihao Ye commented on HIVE-21955:
---------------------------------

An example:

select * from t where ((rfr_page = 'search' and uid is not null) or (rfr_page = 
'index' and uid is not null));

Filter text is:

Filter text = (((rfr_page = 'search') and uid is not null) or ((rfr_page = 
'index') and uid is not null))

However the sarg is:

sarg: leaf-0 = (EQUALS rfr_page search), leaf-1 = (EQUALS rfr_page index), 
leaf-2 = (IS_NULL uid), expr = (and (or leaf-0 leaf-1) (or (not leaf-2) leaf-1) 
(or leaf-0 (not leaf-1)) (or (not leaf-2) (not leaf-1)))

> SearchArgumentImpl generates wrong ExpressionTree in some cases which might 
> result in loss of data 
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-21955
>                 URL: https://issues.apache.org/jira/browse/HIVE-21955
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive, ORC
>            Reporter: Zihao Ye
>            Assignee: Zihao Ye
>            Priority: Critical
>
> ExpressionBuilder applies `pushDownNot`, `foldMaybe`, `flatten`, 
> `convertToCNF`, `flatten` and `buildLeafList` in order to form a 
> non-normalized expression into a CNF expression with the unique leaves.
> After an expression is converted to CNF, there might be more than one 
> non-leaf node which are exactly the same object in the expression tree. If 
> this happens, those non-leaf node will be visited more than once in 
> `buildLeafList` function. As a result, a wrong ExpressionTree is generated.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to