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

Xiao Li commented on SPARK-12218:
---------------------------------

Below is the tree I got. Both explain returns the same tree except the node IDs 
are different

{code}
== Parsed Logical Plan ==
'Filter (('c < 6) && NOT (('a = 2) && 'b IN (1,2)))
+- Relation[a#9,b#10,c#11] 
ParquetRelation[file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-c9681942-d699-4a3c-9ab7-bae84cb36245/table1]

== Analyzed Logical Plan ==
a: int, b: string, c: int
Filter ((c#11 < 6) && NOT ((a#9 = 2) && b#10 IN (1,2)))
+- Relation[a#9,b#10,c#11] 
ParquetRelation[file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-c9681942-d699-4a3c-9ab7-bae84cb36245/table1]

== Optimized Logical Plan ==
Filter ((c#11 < 6) && (NOT (a#9 = 2) || NOT b#10 IN (1,2)))
+- Relation[a#9,b#10,c#11] 
ParquetRelation[file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-c9681942-d699-4a3c-9ab7-bae84cb36245/table1]

== Physical Plan ==
Filter ((c#11 < 6) && (NOT (a#9 = 2) || NOT b#10 IN (1,2)))
+- Scan 
ParquetRelation[file:/private/var/folders/4b/sgmfldk15js406vk7lw5llzw0000gn/T/spark-c9681942-d699-4a3c-9ab7-bae84cb36245/table1]
 PushedFilter: 
[LessThan(c,6),Or(Not(EqualTo(a,2)),Not(In(b,[Ljava.lang.Object;@4bf8a635)))] 
[a#9,b#10,c#11]
{code}

> Boolean logic in sql does not work  "not (A and B)" is not the same as  "(not 
> A) or (not B)"
> --------------------------------------------------------------------------------------------
>
>                 Key: SPARK-12218
>                 URL: https://issues.apache.org/jira/browse/SPARK-12218
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.5.2
>            Reporter: Irakli Machabeli
>            Priority: Blocker
>
> Two identical queries produce different results
> In [2]: sqlContext.read.parquet('prp_enh1').where(" LoanID=62231 and not( 
> PaymentsReceived=0 and ExplicitRoll in ('PreviouslyPaidOff', 
> 'PreviouslyChargedOff'))").count()
> Out[2]: 18
> In [3]: sqlContext.read.parquet('prp_enh1').where(" LoanID=62231 and ( 
> not(PaymentsReceived=0) or not (ExplicitRoll in ('PreviouslyPaidOff', 
> 'PreviouslyChargedOff')))").count()
> Out[3]: 28



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to