GitHub user wangyum opened a pull request:

    https://github.com/apache/spark/pull/22038

    [SPARK-25056][SQL] Unify the InConversion and BinaryComparison behaviour 
when InConversion's list only contains one datatype

    ## What changes were proposed in this pull request?
    before this PR:
    ```scala
    scala> val df = spark.range(4).toDF().selectExpr("cast(id as decimal(9, 2)) 
as id")
    df: org.apache.spark.sql.DataFrame = [id: decimal(9,2)]
    
    scala> df.filter("id in('1', '3')").show
    +---+
    | id|
    +---+
    +---+
    
    scala> df.filter("id = '1' or id ='3'").show
    +----+
    |  id|
    +----+
    |1.00|
    |3.00|
    +----+
    ```
    after this PR:
    ```scala
    scala> val df = spark.range(4).toDF().selectExpr("cast(id as decimal(9, 2)) 
as id")
    df: org.apache.spark.sql.DataFrame = [id: decimal(9,2)]
    
    scala> df.filter("id in('1', '3')").show
    +----+
    |  id|
    +----+
    |1.00|
    |3.00|
    +----+
    
    scala> df.filter("id = '1' or id ='3'").show
    +----+
    |  id|
    +----+
    |1.00|
    |3.00|
    +----+
    ```
    
    ## How was this patch tested?
    
    unit tests


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/wangyum/spark SPARK-25056

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/22038.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #22038
    
----
commit 9459e6e78142f28c209eba3ae3134564004970ec
Author: Yuming Wang <yumwang@...>
Date:   2018-08-08T15:35:40Z

    Unify the InConversion and BinaryComparison behaviour when InConversion's 
list only contains one datatype

----


---

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

Reply via email to