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

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

Hi, [~imachabeli]

Sorry, in the latest 1.6 build, I am unable to reproduce it. I guess the 
problem has been fixed. Could you run the following code? I want to see the 
plan? 

{code}
        val pathOne = s"${dir.getCanonicalPath}/table1"
        (1 to 5).map(i => (i, i.toString, i)).toDF("a", "b", 
"c").write.parquet(pathOne)

        val df = sqlContext.read.parquet(pathOne).where("c < 6 and not (a = 2 
and b in ('1', '2'))")
        df.explain(true)

        val df2 = sqlContext.read.parquet(pathOne).where("c < 6 and (not(a = 2) 
or not(b in ('1', '2')))")
        df2.explain(true)
{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